mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-19 07:49:17 +00:00
oci: Delete the kata oci spec
It's time to delete the kata oci spec implemented just for kata. As we have already done align OCI Spec with oci-spec-rs. Fixes #9766 Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -3,7 +3,6 @@ members = [
|
||||
"kata-sys-util",
|
||||
"kata-types",
|
||||
"logging",
|
||||
"oci",
|
||||
"runtime-spec",
|
||||
"protocols",
|
||||
"safe-path",
|
||||
|
1
src/libs/oci/.gitignore
vendored
1
src/libs/oci/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
Cargo.lock
|
@@ -1,12 +0,0 @@
|
||||
[package]
|
||||
name = "oci"
|
||||
version = "0.1.0"
|
||||
authors = ["The Kata Containers community <kata-dev@lists.katacontainers.io>"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
serde = "1.0.131"
|
||||
serde_derive = "1.0.131"
|
||||
serde_json = "1.0.73"
|
||||
libc = "0.2.112"
|
File diff suppressed because it is too large
Load Diff
@@ -1,80 +0,0 @@
|
||||
// Copyright (c) 2019 Ant Financial
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use std::error;
|
||||
use std::fmt::{Display, Formatter, Result as FmtResult};
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
Io(io::Error),
|
||||
Json(serde_json::Error),
|
||||
}
|
||||
|
||||
impl Display for Error {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
match *self {
|
||||
Error::Io(ref e) => e.fmt(f),
|
||||
Error::Json(ref e) => e.fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for Error {
|
||||
fn cause(&self) -> Option<&dyn error::Error> {
|
||||
match *self {
|
||||
Error::Io(ref e) => Some(e),
|
||||
Error::Json(ref e) => Some(e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<io::Error> for Error {
|
||||
fn from(e: io::Error) -> Error {
|
||||
Error::Io(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<serde_json::Error> for Error {
|
||||
fn from(e: serde_json::Error) -> Error {
|
||||
Error::Json(e)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_writer<W, T>(o: &T, w: W) -> Result<()>
|
||||
where
|
||||
W: io::Write,
|
||||
T: Serialize,
|
||||
{
|
||||
Ok(serde_json::to_writer(w, o)?)
|
||||
}
|
||||
|
||||
pub fn serialize<T>(o: &T, path: &str) -> Result<()>
|
||||
where
|
||||
T: Serialize,
|
||||
{
|
||||
let f = File::create(path)?;
|
||||
Ok(serde_json::to_writer(f, o)?)
|
||||
}
|
||||
|
||||
pub fn to_string<T>(o: &T) -> Result<String>
|
||||
where
|
||||
T: Serialize,
|
||||
{
|
||||
Ok(serde_json::to_string(o)?)
|
||||
}
|
||||
|
||||
pub fn deserialize<T>(path: &str) -> Result<T>
|
||||
where
|
||||
for<'a> T: Deserialize<'a>,
|
||||
{
|
||||
let f = File::open(path)?;
|
||||
Ok(serde_json::from_reader(f)?)
|
||||
}
|
Reference in New Issue
Block a user