This commit is contained in:
parent
c35c472dc9
commit
af6774a511
5 changed files with 7 additions and 7 deletions
|
@ -10,7 +10,7 @@ use crate::block::*;
|
||||||
|
|
||||||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct BlockRef {
|
pub struct BlockRef {
|
||||||
/// Hash of the block, used as partition key
|
/// Hash (blake2 sum) of the block, used as partition key
|
||||||
pub block: Hash,
|
pub block: Hash,
|
||||||
|
|
||||||
/// Id of the Version for the object containing this block, used as sorting key
|
/// Id of the Version for the object containing this block, used as sorting key
|
||||||
|
|
|
@ -57,7 +57,7 @@ impl CRDT for BucketParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BucketParams {
|
impl BucketParams {
|
||||||
/// Initializes a new instance of the Bucket struct
|
/// Create an empty BucketParams with no authorized keys and no website accesss
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
BucketParams {
|
BucketParams {
|
||||||
authorized_keys: crdt::LWWMap::new(),
|
authorized_keys: crdt::LWWMap::new(),
|
||||||
|
@ -67,7 +67,7 @@ impl BucketParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Bucket {
|
impl Bucket {
|
||||||
/// Create a new bucket
|
/// Initializes a new instance of the Bucket struct
|
||||||
pub fn new(name: String) -> Self {
|
pub fn new(name: String) -> Self {
|
||||||
Bucket {
|
Bucket {
|
||||||
name,
|
name,
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub struct Key {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Key {
|
impl Key {
|
||||||
/// Create a new key
|
/// Initialize a new Key, generating a random identifier and associated secret key
|
||||||
pub fn new(name: String) -> Self {
|
pub fn new(name: String) -> Self {
|
||||||
let key_id = format!("GK{}", hex::encode(&rand::random::<[u8; 12]>()[..]));
|
let key_id = format!("GK{}", hex::encode(&rand::random::<[u8; 12]>()[..]));
|
||||||
let secret_key = hex::encode(&rand::random::<[u8; 32]>()[..]);
|
let secret_key = hex::encode(&rand::random::<[u8; 32]>()[..]);
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub struct Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Object {
|
impl Object {
|
||||||
/// Create an object from parts
|
/// Initialize an Object struct from parts
|
||||||
pub fn new(bucket: String, key: String, versions: Vec<ObjectVersion>) -> Self {
|
pub fn new(bucket: String, key: String, versions: Vec<ObjectVersion>) -> Self {
|
||||||
let mut ret = Self {
|
let mut ret = Self {
|
||||||
bucket,
|
bucket,
|
||||||
|
@ -102,7 +102,7 @@ impl CRDT for ObjectVersionState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data about an object version
|
/// Data stored in object version
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Serialize, Deserialize)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Serialize, Deserialize)]
|
||||||
pub enum ObjectVersionData {
|
pub enum ObjectVersionData {
|
||||||
/// The object was deleted, this Version is a tombstone to mark it as such
|
/// The object was deleted, this Version is a tombstone to mark it as such
|
||||||
|
|
|
@ -72,7 +72,7 @@ impl PartialOrd for VersionBlockKey {
|
||||||
/// Informations about a single block
|
/// Informations about a single block
|
||||||
#[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Copy, Debug, Serialize, Deserialize)]
|
#[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Copy, Debug, Serialize, Deserialize)]
|
||||||
pub struct VersionBlock {
|
pub struct VersionBlock {
|
||||||
/// Hash of the block
|
/// Blake2 sum of the block
|
||||||
pub hash: Hash,
|
pub hash: Hash,
|
||||||
/// Size of the block
|
/// Size of the block
|
||||||
pub size: u64,
|
pub size: u64,
|
||||||
|
|
Loading…
Reference in a new issue