consistency

package
v0.0.0-...-b0c7fd6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level defines Cassandra-like consistency levels.

const (
	// One implies that an acknowledgement from a single node is enough to complete the operation.
	One Level = iota
	// Two needs acknowledgement from at least two nodes to complete the operation.
	Two
	// Quorum needs acknowledgement from N/2+1 of nodes to complete the operation.
	Quorum
	// All requires acknowledgement from ALL nodes.
	All
)

func FromString

func FromString(s string) (Level, bool)

func (Level) N

func (l Level) N(total int) int

N returns how many replicas are needed to satisfy the consistency level if there are n replicas in total. Note that the returned number can be greater than total number of nodes. For example the consistency level Two always requires two nodes even if total number of nodes is 1.

func (Level) String

func (l Level) String() string

String returns string representation of the consistency level.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL