mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-07 13:23:33 +00:00
rename types to CamelCase
This commit is contained in:
committed by
Alex Auvolat
parent
6644df6b96
commit
e4b9e4e24d
+1
-1
@@ -137,7 +137,7 @@ impl BlockManager {
|
||||
Message::PutBlock(m) => self.write_block(&m.hash, &m.data).await,
|
||||
Message::GetBlock(h) => self.read_block(h).await,
|
||||
Message::NeedBlockQuery(h) => self.need_block(h).await.map(Message::NeedBlockReply),
|
||||
_ => Err(Error::BadRPC("Unexpected RPC message".to_string())),
|
||||
_ => Err(Error::BadRpc("Unexpected RPC message".to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::sync::Arc;
|
||||
|
||||
use garage_util::data::*;
|
||||
|
||||
use garage_table::crdt::CRDT;
|
||||
use garage_table::crdt::Crdt;
|
||||
use garage_table::*;
|
||||
|
||||
use crate::block::*;
|
||||
@@ -14,18 +14,18 @@ pub struct BlockRef {
|
||||
pub block: Hash,
|
||||
|
||||
/// Id of the Version for the object containing this block, used as sorting key
|
||||
pub version: UUID,
|
||||
pub version: Uuid,
|
||||
|
||||
// Keep track of deleted status
|
||||
/// Is the Version that contains this block deleted
|
||||
pub deleted: crdt::Bool,
|
||||
}
|
||||
|
||||
impl Entry<Hash, UUID> for BlockRef {
|
||||
impl Entry<Hash, Uuid> for BlockRef {
|
||||
fn partition_key(&self) -> &Hash {
|
||||
&self.block
|
||||
}
|
||||
fn sort_key(&self) -> &UUID {
|
||||
fn sort_key(&self) -> &Uuid {
|
||||
&self.version
|
||||
}
|
||||
fn is_tombstone(&self) -> bool {
|
||||
@@ -33,7 +33,7 @@ impl Entry<Hash, UUID> for BlockRef {
|
||||
}
|
||||
}
|
||||
|
||||
impl CRDT for BlockRef {
|
||||
impl Crdt for BlockRef {
|
||||
fn merge(&mut self, other: &Self) {
|
||||
self.deleted.merge(&other.deleted);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ pub struct BlockRefTable {
|
||||
|
||||
impl TableSchema for BlockRefTable {
|
||||
type P = Hash;
|
||||
type S = UUID;
|
||||
type S = Uuid;
|
||||
type E = BlockRef;
|
||||
type Filter = DeletedFilter;
|
||||
|
||||
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use garage_table::crdt::CRDT;
|
||||
use garage_table::crdt::Crdt;
|
||||
use garage_table::*;
|
||||
|
||||
use crate::key_table::PermissionSet;
|
||||
@@ -15,7 +15,7 @@ pub struct Bucket {
|
||||
/// Name of the bucket
|
||||
pub name: String,
|
||||
/// State, and configuration if not deleted, of the bucket
|
||||
pub state: crdt::LWW<BucketState>,
|
||||
pub state: crdt::Lww<BucketState>,
|
||||
}
|
||||
|
||||
/// State of a bucket
|
||||
@@ -27,7 +27,7 @@ pub enum BucketState {
|
||||
Present(BucketParams),
|
||||
}
|
||||
|
||||
impl CRDT for BucketState {
|
||||
impl Crdt for BucketState {
|
||||
fn merge(&mut self, o: &Self) {
|
||||
match o {
|
||||
BucketState::Deleted => *self = BucketState::Deleted,
|
||||
@@ -44,22 +44,22 @@ impl CRDT for BucketState {
|
||||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct BucketParams {
|
||||
/// Map of key with access to the bucket, and what kind of access they give
|
||||
pub authorized_keys: crdt::LWWMap<String, PermissionSet>,
|
||||
pub authorized_keys: crdt::LwwMap<String, PermissionSet>,
|
||||
/// Is the bucket served as http
|
||||
pub website: crdt::LWW<bool>,
|
||||
pub website: crdt::Lww<bool>,
|
||||
}
|
||||
|
||||
impl BucketParams {
|
||||
/// Create an empty BucketParams with no authorized keys and no website accesss
|
||||
pub fn new() -> Self {
|
||||
BucketParams {
|
||||
authorized_keys: crdt::LWWMap::new(),
|
||||
website: crdt::LWW::new(false),
|
||||
authorized_keys: crdt::LwwMap::new(),
|
||||
website: crdt::Lww::new(false),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CRDT for BucketParams {
|
||||
impl Crdt for BucketParams {
|
||||
fn merge(&mut self, o: &Self) {
|
||||
self.authorized_keys.merge(&o.authorized_keys);
|
||||
self.website.merge(&o.website);
|
||||
@@ -77,7 +77,7 @@ impl Bucket {
|
||||
pub fn new(name: String) -> Self {
|
||||
Bucket {
|
||||
name,
|
||||
state: crdt::LWW::new(BucketState::Present(BucketParams::new())),
|
||||
state: crdt::Lww::new(BucketState::Present(BucketParams::new())),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ impl Entry<EmptyKey, String> for Bucket {
|
||||
}
|
||||
}
|
||||
|
||||
impl CRDT for Bucket {
|
||||
impl Crdt for Bucket {
|
||||
fn merge(&mut self, other: &Self) {
|
||||
self.state.merge(&other.state);
|
||||
}
|
||||
|
||||
+10
-10
@@ -13,14 +13,14 @@ pub struct Key {
|
||||
pub secret_key: String,
|
||||
|
||||
/// Name for the key
|
||||
pub name: crdt::LWW<String>,
|
||||
pub name: crdt::Lww<String>,
|
||||
|
||||
/// Is the key deleted
|
||||
pub deleted: crdt::Bool,
|
||||
|
||||
/// Buckets in which the key is authorized. Empty if `Key` is deleted
|
||||
// CRDT interaction: deleted implies authorized_buckets is empty
|
||||
pub authorized_buckets: crdt::LWWMap<String, PermissionSet>,
|
||||
pub authorized_buckets: crdt::LwwMap<String, PermissionSet>,
|
||||
}
|
||||
|
||||
impl Key {
|
||||
@@ -31,9 +31,9 @@ impl Key {
|
||||
Self {
|
||||
key_id,
|
||||
secret_key,
|
||||
name: crdt::LWW::new(name),
|
||||
name: crdt::Lww::new(name),
|
||||
deleted: crdt::Bool::new(false),
|
||||
authorized_buckets: crdt::LWWMap::new(),
|
||||
authorized_buckets: crdt::LwwMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ impl Key {
|
||||
Self {
|
||||
key_id: key_id.to_string(),
|
||||
secret_key: secret_key.to_string(),
|
||||
name: crdt::LWW::new(name.to_string()),
|
||||
name: crdt::Lww::new(name.to_string()),
|
||||
deleted: crdt::Bool::new(false),
|
||||
authorized_buckets: crdt::LWWMap::new(),
|
||||
authorized_buckets: crdt::LwwMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ impl Key {
|
||||
Self {
|
||||
key_id,
|
||||
secret_key: "".into(),
|
||||
name: crdt::LWW::new("".to_string()),
|
||||
name: crdt::Lww::new("".to_string()),
|
||||
deleted: crdt::Bool::new(true),
|
||||
authorized_buckets: crdt::LWWMap::new(),
|
||||
authorized_buckets: crdt::LwwMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ pub struct PermissionSet {
|
||||
pub allow_write: bool,
|
||||
}
|
||||
|
||||
impl AutoCRDT for PermissionSet {
|
||||
impl AutoCrdt for PermissionSet {
|
||||
const WARN_IF_DIFFERENT: bool = true;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ impl Entry<EmptyKey, String> for Key {
|
||||
}
|
||||
}
|
||||
|
||||
impl CRDT for Key {
|
||||
impl Crdt for Key {
|
||||
fn merge(&mut self, other: &Self) {
|
||||
self.name.merge(&other.name);
|
||||
self.deleted.merge(&other.deleted);
|
||||
|
||||
@@ -64,7 +64,7 @@ impl Object {
|
||||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectVersion {
|
||||
/// Id of the version
|
||||
pub uuid: UUID,
|
||||
pub uuid: Uuid,
|
||||
/// Timestamp of when the object was created
|
||||
pub timestamp: u64,
|
||||
/// State of the version
|
||||
@@ -82,7 +82,7 @@ pub enum ObjectVersionState {
|
||||
Aborted,
|
||||
}
|
||||
|
||||
impl CRDT for ObjectVersionState {
|
||||
impl Crdt for ObjectVersionState {
|
||||
fn merge(&mut self, other: &Self) {
|
||||
use ObjectVersionState::*;
|
||||
match other {
|
||||
@@ -115,7 +115,7 @@ pub enum ObjectVersionData {
|
||||
FirstBlock(ObjectVersionMeta, Hash),
|
||||
}
|
||||
|
||||
impl AutoCRDT for ObjectVersionData {
|
||||
impl AutoCrdt for ObjectVersionData {
|
||||
const WARN_IF_DIFFERENT: bool = true;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ pub struct ObjectVersionHeaders {
|
||||
}
|
||||
|
||||
impl ObjectVersion {
|
||||
fn cmp_key(&self) -> (u64, UUID) {
|
||||
fn cmp_key(&self) -> (u64, Uuid) {
|
||||
(self.timestamp, self.uuid)
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ impl Entry<String, String> for Object {
|
||||
}
|
||||
}
|
||||
|
||||
impl CRDT for Object {
|
||||
impl Crdt for Object {
|
||||
fn merge(&mut self, other: &Self) {
|
||||
// Merge versions from other into here
|
||||
for other_v in other.versions.iter() {
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::block_ref_table::*;
|
||||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Version {
|
||||
/// UUID of the version, used as partition key
|
||||
pub uuid: UUID,
|
||||
pub uuid: Uuid,
|
||||
|
||||
// Actual data: the blocks for this version
|
||||
// In the case of a multipart upload, also store the etags
|
||||
@@ -35,7 +35,7 @@ pub struct Version {
|
||||
}
|
||||
|
||||
impl Version {
|
||||
pub fn new(uuid: UUID, bucket: String, key: String, deleted: bool) -> Self {
|
||||
pub fn new(uuid: Uuid, bucket: String, key: String, deleted: bool) -> Self {
|
||||
Self {
|
||||
uuid,
|
||||
deleted: deleted.into(),
|
||||
@@ -78,7 +78,7 @@ pub struct VersionBlock {
|
||||
pub size: u64,
|
||||
}
|
||||
|
||||
impl AutoCRDT for VersionBlock {
|
||||
impl AutoCrdt for VersionBlock {
|
||||
const WARN_IF_DIFFERENT: bool = true;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ impl Entry<Hash, EmptyKey> for Version {
|
||||
}
|
||||
}
|
||||
|
||||
impl CRDT for Version {
|
||||
impl Crdt for Version {
|
||||
fn merge(&mut self, other: &Self) {
|
||||
self.deleted.merge(&other.deleted);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user