carpenter/table

Types

pub type Privacy {
  Private
  Protected
  Public
}

Constructors

  • Private
  • Protected
  • Public
pub type Set(k, v) {
  Set(table: Table(k, v))
}

Constructors

  • Set(table: Table(k, v))
pub type Table(k, v) {
  Table(name: atom.Atom)
}

Constructors

  • Table(name: atom.Atom)
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 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) -> Set(a, b)

Delete all objects with key key from the table.

pub fn delete_all(set: Set(a, b)) -> Set(a, b)

Delete all objects belonging to a table

pub fn drop(set: Set(a, b)) -> Nil

Deletes the entire 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), key: a, value: b) -> Set(a, b)

Insert a value into the ets table.

pub fn lookup(set: Set(a, b), key: a) -> Option(List(#(a, b)))

Retrieve a value from the ets table. Return an option if the value could not be found.

pub fn ordered_set(builder: TableBuilder(a, b)) -> Set(a, b)

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 set(builder: TableBuilder(a, b)) -> Set(a, b)

Specify table as a set

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.

Search Document