svs

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SvsNodeDesc *schema.NodeImplDesc

Functions

func CreateSvsNode

func CreateSvsNode(node *schema.Node) schema.NodeImpl

(AI GENERATED DESCRIPTION): Creates and configures an SvsNode, establishing a leaf node for data items and a notification express point with specified matching rules, lifetimes, and attaching event listeners.

Types

type MissingData

type MissingData struct {
	Name     enc.Name
	StartSeq uint64
	EndSeq   uint64
}

type SvsNode

type SvsNode struct {
	schema.BaseNodeImpl

	OnMissingData *schema.EventTarget

	SyncInterval        time.Duration
	SuppressionInterval time.Duration
	BaseMatching        enc.Matching
	ChannelSize         uint64
	SelfName            enc.Name
	// contains filtered or unexported fields
}

SvsNode implements the StateVectorSync but works for only one instance. Similar is RegisterPolicy. A better implementation is needed if there is a need that multiple producers under the same name pattern that runs on the same application instance. It would also be more natural if we make 1-1 mapping between MatchedNodes and SVS instances, instead of the Node and the SVS instance, which is against the philosophy of matching. Also, this sample always starts from sequence number 0.

func (*SvsNode) CastTo

func (n *SvsNode) CastTo(ptr any) any

(AI GENERATED DESCRIPTION): Returns the node as either a *SvsNode or its embedded *schema.BaseNodeImpl, or nil if the requested type is not supported.

func (*SvsNode) GetDataName

func (n *SvsNode) GetDataName(mNode schema.MatchedNode, name []byte, seq uint64) enc.Name

(AI GENERATED DESCRIPTION): Generates a full data packet name by extending the matched node’s name with a given generic component followed by a sequence‑number component.

func (*SvsNode) MissingDataChannel

func (n *SvsNode) MissingDataChannel() chan MissingData

(AI GENERATED DESCRIPTION): Provides direct access to the node’s `MissingData` channel, which emits notifications of missing data (use this channel rather than the OnMissingData callback).

func (*SvsNode) MySequence

func (n *SvsNode) MySequence() uint64

(AI GENERATED DESCRIPTION): Returns the node’s current sequence number.

func (*SvsNode) NewData

func (n *SvsNode) NewData(mNode schema.MatchedNode, content enc.Wire) enc.Wire

(AI GENERATED DESCRIPTION): Creates a new Data packet with an incremented sequence number, updates the node’s local state vector, and broadcasts the state vector, returning the encoded packet (or empty if the provide operation fails).

func (*SvsNode) NodeImplTrait

func (n *SvsNode) NodeImplTrait() schema.NodeImpl

(AI GENERATED DESCRIPTION): Returns the SvsNode instance as a schema.NodeImpl.

func (*SvsNode) String added in v1.4.3

func (n *SvsNode) String() string

(AI GENERATED DESCRIPTION): Returns a constant string “svs-node” as the string representation of an SvsNode.

type SyncState

type SyncState int
const (
	SyncSteady SyncState = iota
	SyncSuppression
)

Jump to

Keyboard shortcuts

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