aarondb/sharding/semantics

Types

pub type QueryReduction {
  Complete(query_types.QueryResult)
  Partial(
    result: query_types.QueryResult,
    unavailable: List(Int),
    timed_out: List(#(Int, Int)),
  )
}

Constructors

A shard outcome is data: callers must decide whether a partial response is acceptable instead of silently treating a timeout as an empty result.

pub type QueryReply {
  QuerySucceeded(shard_id: Int, result: query_types.QueryResult)
  QueryUnavailable(shard_id: Int)
  QueryTimedOut(shard_id: Int, deadline_ms: Int)
}

Constructors

  • QuerySucceeded(shard_id: Int, result: query_types.QueryResult)
  • QueryUnavailable(shard_id: Int)
  • QueryTimedOut(shard_id: Int, deadline_ms: Int)
pub type RetryDecision {
  RetryNow(attempt: Int)
  RetryExhausted(attempt: Int)
  DeadlineElapsed(deadline_ms: Int)
}

Constructors

  • RetryNow(attempt: Int)
  • RetryExhausted(attempt: Int)
  • DeadlineElapsed(deadline_ms: Int)

Values

pub fn group_facts(
  facts: List(#(fact.Eid, String, fact.Value)),
  vnodes: dict.Dict(Int, Int),
  sorted_hashes: List(Int),
) -> Result(
  dict.Dict(Int, List(#(fact.Eid, String, fact.Value))),
  String,
)
pub fn reduce_query_replies(
  replies: List(QueryReply),
) -> QueryReduction
pub fn retry_decision(
  attempt: Int,
  max_attempts: Int,
  deadline_elapsed: Bool,
  deadline_ms: Int,
) -> RetryDecision
pub fn route(
  eid: fact.Eid,
  vnodes: dict.Dict(Int, Int),
  sorted_hashes: List(Int),
) -> option.Option(Int)
Search Document