aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorTrinity Pointard <trinity.pointard@gmail.com>2021-05-02 23:13:08 +0200
committerAlex Auvolat <alex@adnab.me>2021-05-03 22:15:09 +0200
commite4b9e4e24d006373a20cfcbdac9dba5e399ee182 (patch)
tree620e24d182e6db4ad7ddca274eb8071d8241a1d6 /src/model
parent6644df6b969df3f7ff0516ab7acd9b600dff0a54 (diff)
downloadgarage-e4b9e4e24d006373a20cfcbdac9dba5e399ee182.tar.gz
garage-e4b9e4e24d006373a20cfcbdac9dba5e399ee182.zip
rename types to CamelCase
Diffstat (limited to 'src/model')
-rw-r--r--src/model/block.rs2
-rw-r--r--src/model/block_ref_table.rs12
-rw-r--r--src/model/bucket_table.rs20
-rw-r--r--src/model/key_table.rs20
-rw-r--r--src/model/object_table.rs10
-rw-r--r--src/model/version_table.rs8
6 files changed, 36 insertions, 36 deletions
diff --git a/src/model/block.rs b/src/model/block.rs
index 1c9aa08b..348f0711 100644
--- a/src/model/block.rs
+++ b/src/model/block.rs
@@ -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())),
}
}
diff --git a/src/model/block_ref_table.rs b/src/model/block_ref_table.rs
index c2d77fd3..f8f529c4 100644
--- a/src/model/block_ref_table.rs
+++ b/src/model/block_ref_table.rs
@@ -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;
diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs
index 9f89dccc..168ed713 100644
--- a/src/model/bucket_table.rs
+++ b/src/model/bucket_table.rs
@@ -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);
}
diff --git a/src/model/key_table.rs b/src/model/key_table.rs
index ba1f6b81..a6186aa9 100644
--- a/src/model/key_table.rs
+++ b/src/model/key_table.rs
@@ -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);
diff --git a/src/model/object_table.rs b/src/model/object_table.rs
index f0473836..d743a2b6 100644
--- a/src/model/object_table.rs
+++ b/src/model/object_table.rs
@@ -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() {
diff --git a/src/model/version_table.rs b/src/model/version_table.rs
index dd088224..bff7d4bb 100644
--- a/src/model/version_table.rs
+++ b/src/model/version_table.rs
@@ -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);