use serde::{Deserialize, Serialize};
use crate::{base_types::ObjectID, id::UID};
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
pub struct VecMap<K, V> {
pub contents: Vec<Entry<K, V>>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
pub struct Entry<K, V> {
pub key: K,
pub value: V,
}
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
pub struct VecSet<T> {
pub contents: Vec<T>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
pub struct TableVec {
pub contents: Table,
}
impl Default for TableVec {
fn default() -> Self {
TableVec {
contents: Table {
id: ObjectID::ZERO,
size: 0,
},
}
}
}
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
pub struct Table {
pub id: ObjectID,
pub size: u64,
}
impl Default for Table {
fn default() -> Self {
Table {
id: ObjectID::ZERO,
size: 0,
}
}
}
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
pub struct LinkedTable<K> {
pub id: ObjectID,
pub size: u64,
pub head: Option<K>,
pub tail: Option<K>,
}
impl<K> Default for LinkedTable<K> {
fn default() -> Self {
LinkedTable {
id: ObjectID::ZERO,
size: 0,
head: None,
tail: None,
}
}
}
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
pub struct LinkedTableNode<K, V> {
pub prev: Option<K>,
pub next: Option<K>,
pub value: V,
}
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
pub struct Bag {
pub id: UID,
pub size: u64,
}
impl Default for Bag {
fn default() -> Self {
Self {
id: UID::new(ObjectID::ZERO),
size: 0,
}
}
}