shopcart

package module
v0.0.0-...-0008579 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

shopcart

shopcart models an AWORSET set CRDT.

For more information check out this report: Distributed State in PGo.

Model

We express query and update methods of CRDTs using mapping macros in MPCal. For each CRDT, we define a mapping macro that its read section implements the query method and its write section implements the update method. In this case, the mapping macro is AWORSet.

According to the CRDT paper [Shapiro et al. 2011], every node infinitely often sends its state to every other node. Each node after receiving another node’s state, merges the received state into its local state. So there is no restriction on the execution order of merge operations. To simulate this behavior, we created a new process in the specification that runs concurrently with node archetypes. This process, in each of its execution step, merges states of two nodes that do not have equal states (merging states of two nodes with the same state has no effect). The model checker will explore every possible execution orders of running this process along with that of the node archetypes. This allows us to make sure that a system works correctly in every possible way that merge operations can happen. Note that for this, we do not use an archetype, and we use a process because we wish to model-check this behavior without compiling it into Go. The actual broadcasting in the Go implementation is included in the CRDT resources.

Properties
  • Eventual Delivery: an update delivered at some node is eventually delivered to all nodes.
  • Strong Convergence: Correct replicas that have delivered the same updates have equivalent state.
  • Termination: All method executions terminate.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ANode = distsys.MPCalArchetype{
	Name:              "ANode",
	Label:             "ANode.nodeLoop",
	RequiredRefParams: []string{"ANode.crdt", "ANode.in", "ANode.out"},
	RequiredValParams: []string{},
	JumpTable:         jumpTable,
	ProcTable:         procTable,
	PreAmble: func(iface distsys.ArchetypeInterface) {
	},
}
View Source
var ANodeBench = distsys.MPCalArchetype{
	Name:              "ANodeBench",
	Label:             "ANodeBench.nodeBenchLoop",
	RequiredRefParams: []string{"ANodeBench.crdt", "ANodeBench.out", "ANodeBench.c"},
	RequiredValParams: []string{},
	JumpTable:         jumpTable,
	ProcTable:         procTable,
	PreAmble: func(iface distsys.ArchetypeInterface) {
		iface.EnsureArchetypeResourceLocal("ANodeBench.r", tla.MakeNumber(0))
	},
}

Functions

func AddCmd

func AddCmd(iface distsys.ArchetypeInterface) tla.Value

func AddFinish

func AddFinish(iface distsys.ArchetypeInterface) tla.Value

func AddStart

func AddStart(iface distsys.ArchetypeInterface) tla.Value

func BenchElemSet

func BenchElemSet(iface distsys.ArchetypeInterface) tla.Value

func CompareVectorClock

func CompareVectorClock(iface distsys.ArchetypeInterface, v10 tla.Value, v20 tla.Value) tla.Value

func Elem1

func Elem1(iface distsys.ArchetypeInterface) tla.Value

func Elem2

func Elem2(iface distsys.ArchetypeInterface) tla.Value

func Elem3

func Elem3(iface distsys.ArchetypeInterface) tla.Value

func GetVal

func GetVal(iface distsys.ArchetypeInterface, n0 tla.Value, round tla.Value) tla.Value

func IsOKSet

func IsOKSet(iface distsys.ArchetypeInterface, xset tla.Value, round0 tla.Value) tla.Value

func Max

func MergeKeys

func MergeKeys(iface distsys.ArchetypeInterface, a0 tla.Value, b0 tla.Value) tla.Value

func MergeVectorClock

func MergeVectorClock(iface distsys.ArchetypeInterface, v1 tla.Value, v2 tla.Value) tla.Value

func NodeSet

func NodeSet(iface distsys.ArchetypeInterface) tla.Value

func Null

func Null(iface distsys.ArchetypeInterface) tla.Value

func Query

func Query(iface distsys.ArchetypeInterface, r tla.Value) tla.Value

func RemoveCmd

func RemoveCmd(iface distsys.ArchetypeInterface) tla.Value

Types

type Event

type Event int
const (
	AddStartEvent Event = iota + 1
	AddFinishEvent
)

func (Event) String

func (e Event) String() string

type Node

type Node struct {
	Id     int
	Config configs.Root
	// contains filtered or unexported fields
}

func NewNode

func NewNode(id int, c configs.Root, ch chan Event) *Node

func (*Node) Close

func (n *Node) Close() error

func (*Node) Run

func (n *Node) Run() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳