carpenter/table
Types
pub type TableBuilder(k, v) {
TableBuilder(
name: String,
privacy: Option(Privacy),
write_concurrency: Option(WriteConcurrency),
read_concurrency: Option(Bool),
decentralized_counters: Option(Bool),
compressed: Bool,
)
}
Constructors
-
TableBuilder( name: String, privacy: Option(Privacy), write_concurrency: Option(WriteConcurrency), read_concurrency: Option(Bool), decentralized_counters: Option(Bool), compressed: Bool, )
pub type WriteConcurrency {
WriteConcurrency
NoWriteConcurrency
AutoWriteConcurrency
}
Constructors
-
WriteConcurrency
-
NoWriteConcurrency
-
AutoWriteConcurrency
Functions
pub fn build(name: String) -> TableBuilder(a, b)
Begin building a new table with the given name. Ensure your table names are unique,
otherwise you will encounter a badarg
failure at runtime when attempting to build it.
pub fn compression(
builder: TableBuilder(a, b),
compressed: Bool,
) -> TableBuilder(a, b)
Whether or not the table is compressed.
pub fn contains(set: Set(a, b), key: a) -> Bool
Returns a boolean based on the existence of a key within the table
pub fn decentralized_counters(
builder: TableBuilder(a, b),
counters: Bool,
) -> TableBuilder(a, b)
Whether or not the table uses decentralized_counters.
Acceptable values are True
or False
.
You should probably choose True
unless you are going to be polling
the table for its size and memory usage frequently.
pub fn delete(set: Set(a, b), key: a) -> Nil
Delete all objects with key key
from the table.
pub fn delete_object(set: Set(a, b), object: #(a, b)) -> Nil
Delete an exact object from the table
pub fn give_away(set: Set(a, b), pid: Pid, gift_data: c) -> Nil
Give the table to another process.
pub fn insert(set: Set(a, b), objects: List(#(a, b))) -> Nil
Insert a list of objects into the set
pub fn insert_new(set: Set(a, b), objects: List(#(a, b))) -> Bool
Insert a list of objects without overwriting any existing keys.
This will not insert ANY object unless ALL keys do not exist.
pub fn lookup(set: Set(a, b), key: a) -> List(#(a, b))
Retrieve a list of objects from the table.
pub fn ordered_set(
builder: TableBuilder(a, b),
) -> Result(Set(a, b), Nil)
Specify table as an ordered_set
pub fn privacy(
builder: TableBuilder(a, b),
privacy: Privacy,
) -> TableBuilder(a, b)
Set the privacy of the table.
Acceptable values are Private
, Protected
, and Public
.
pub fn read_concurrency(
builder: TableBuilder(a, b),
con: Bool,
) -> TableBuilder(a, b)
Whether or not the table uses read_concurrency. Acceptable values are True
or `False.
pub fn take(set: Set(a, b), key: a) -> List(#(a, b))
Return and remove a list of objects with the given key
pub fn write_concurrency(
builder: TableBuilder(a, b),
con: WriteConcurrency,
) -> TableBuilder(a, b)
Set the write_concurrency of the table.
Acceptable values are WriteConcurrency
, NoWriteConcurrency
, or AutoWriteConcurrency
.