pbkvs

package module
v0.0.0-...-2e7796a Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

pvkvs

A key-value store that uses primary-backup replication. We used the following document as the reference: http://www.sc.ehu.es/acwlaalm/sdi/replication-schemas.pdf

Assumptions:

  • Crash-stop failure model
  • Having access to a perfect failure detector

In each step of the execution, we consider a replica as the primary that has the lowest ID amongst all alive replicas. Primary synchronously replicates requests to the backup nodes. Clients must send write requests only to the primary replica. The primary always has the same state as backups or the primary is one step ahead. Therefore, reading from a backup might return an old value. In this spec, read requests are sent only to the primary.

If the primary node fails while processing a write request, the client won't receive any response back. If the primary replicated the write request to at least one backup node, the request will be applied to the system, otherwise, it won't. Therefore, the system provides no guarantee when a client don't receive a response for its write request. However, it's fine since the client retries and all operations are idempotent.

We define consistency property for this system as: when primary node sends a response back to a client, all replicas (including primary) have a same state.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AClient = distsys.MPCalArchetype{
	Name:              "AClient",
	Label:             "AClient.clientLoop",
	RequiredRefParams: []string{"AClient.net", "AClient.fd", "AClient.primary", "AClient.netLen", "AClient.input", "AClient.output"},
	RequiredValParams: []string{},
	JumpTable:         jumpTable,
	ProcTable:         procTable,
	PreAmble: func(iface distsys.ArchetypeInterface) {
		iface.EnsureArchetypeResourceLocal("AClient.req", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AClient.resp", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AClient.msg", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AClient.replica", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AClient.idx", tla.MakeNumber(0))
	},
}
View Source
var AReplica = distsys.MPCalArchetype{
	Name:              "AReplica",
	Label:             "AReplica.replicaLoop",
	RequiredRefParams: []string{"AReplica.net", "AReplica.fs", "AReplica.fd", "AReplica.netEnabled", "AReplica.primary", "AReplica.netLen"},
	RequiredValParams: []string{},
	JumpTable:         jumpTable,
	ProcTable:         procTable,
	PreAmble: func(iface distsys.ArchetypeInterface) {
		iface.EnsureArchetypeResourceLocal("AReplica.req", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AReplica.respBody", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AReplica.respTyp", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AReplica.idx", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AReplica.repReq", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AReplica.repResp", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AReplica.resp", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AReplica.replicaSet", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AReplica.shouldSync", tla.ModuleFALSE)
		iface.EnsureArchetypeResourceLocal("AReplica.lastPutBody", tla.MakeRecord([]tla.RecordField{
			{tla.MakeString("versionNumber"), tla.MakeNumber(0)},
		}))
		iface.EnsureArchetypeResourceLocal("AReplica.replica", tla.Value{})
	},
}

Functions

func ACK_MSG_BODY

func ACK_MSG_BODY(iface distsys.ArchetypeInterface) tla.Value

func BACKUP_SRC

func BACKUP_SRC(iface distsys.ArchetypeInterface) tla.Value

func CLIENT_SET

func CLIENT_SET(iface distsys.ArchetypeInterface) tla.Value

func CLIENT_SRC

func CLIENT_SRC(iface distsys.ArchetypeInterface) tla.Value

func GET_REQ

func GET_REQ(iface distsys.ArchetypeInterface) tla.Value

func GET_RESP

func GET_RESP(iface distsys.ArchetypeInterface) tla.Value

func KEY1

func KEY1(iface distsys.ArchetypeInterface) tla.Value

func KEY_SET

func KEY_SET(iface distsys.ArchetypeInterface) tla.Value

func MSG_INDEX_SET

func MSG_INDEX_SET(iface distsys.ArchetypeInterface) tla.Value

func NODE_SET

func NODE_SET(iface distsys.ArchetypeInterface) tla.Value

func NULL

func NULL(iface distsys.ArchetypeInterface) tla.Value

func NUM_NODES

func NUM_NODES(iface distsys.ArchetypeInterface) tla.Value

func PRIMARY_SRC

func PRIMARY_SRC(iface distsys.ArchetypeInterface) tla.Value

func PUT_REQ

func PUT_REQ(iface distsys.ArchetypeInterface) tla.Value

func PUT_RESP

func PUT_RESP(iface distsys.ArchetypeInterface) tla.Value

func REPLICA_SET

func REPLICA_SET(iface distsys.ArchetypeInterface) tla.Value

func REQ_INDEX

func REQ_INDEX(iface distsys.ArchetypeInterface) tla.Value

func RESP_INDEX

func RESP_INDEX(iface distsys.ArchetypeInterface) tla.Value

func SYNC_REQ

func SYNC_REQ(iface distsys.ArchetypeInterface) tla.Value

func SYNC_RESP

func SYNC_RESP(iface distsys.ArchetypeInterface) tla.Value

func VALUE1

func VALUE1(iface distsys.ArchetypeInterface) tla.Value

func VALUE2

func VALUE2(iface distsys.ArchetypeInterface) tla.Value

Types

type LeaderElection

type LeaderElection struct {
	distsys.ArchetypeResourceLeafMixin
}

func NewLeaderElection

func NewLeaderElection() *LeaderElection

func (*LeaderElection) Abort

func (res *LeaderElection) Abort() chan struct{}

func (*LeaderElection) Close

func (res *LeaderElection) Close() error

func (*LeaderElection) Commit

func (res *LeaderElection) Commit() chan struct{}

func (*LeaderElection) PreCommit

func (res *LeaderElection) PreCommit() chan error

func (*LeaderElection) ReadValue

func (res *LeaderElection) ReadValue() (tla.Value, error)

func (*LeaderElection) WriteValue

func (res *LeaderElection) WriteValue(value tla.Value) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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