internal

package
v0.0.0-...-592a62f Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {

	// Called when all dependencies are resolved.
	TrySendToTxnCache func(id cacheID) bool
	// Set the id generator to get a random ID.
	RandCacheID func() cacheID
	// Set the callback that the node is notified.
	OnNotified func(callback func())
	// contains filtered or unexported fields
}

Node is a node in the dependency graph used in conflict detection.

type Slots

type Slots struct {
	// contains filtered or unexported fields
}

Slots implements slot-based conflict detection. It holds references to Node, which can be used to build a DAG of dependency.

func NewSlots

func NewSlots(numSlots uint64) *Slots

NewSlots creates a new Slots.

func (*Slots) Add

func (s *Slots) Add(elem *Node)

Add adds an elem to the slots and calls DependOn for elem.

func (*Slots) AllocNode

func (s *Slots) AllocNode(hashes []uint64) *Node

AllocNode allocates a new node and initializes it with the given hashes. TODO: reuse node if necessary. Currently it's impossible if async-notify is used. The reason is a node can step functions `assignTo`, `Remove`, `free`, then `assignTo`. again. In the last `assignTo`, it can never know whether the node has been reused or not.

func (*Slots) Remove

func (s *Slots) Remove(elem *Node)

Remove removes an element from the Slots.

Jump to

Keyboard shortcuts

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