svs

package
v0.0.0-alpha.16 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: ISC Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeVector     enc.TLNum = 0xc9
	TypeEntry      enc.TLNum = 0xca
	TypeEntrySeqno enc.TLNum = 0xcc
)

Variables

This section is empty.

Functions

func BoundedRand

func BoundedRand(min, max time.Duration) time.Duration

func JitterToBounds

func JitterToBounds(base time.Duration, jitter float64) (time.Duration, time.Duration)

Types

type BoltDB

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

func NewBoltDB

func NewBoltDB(path string, bucket []byte) (BoltDB, error)

func (BoltDB) Close

func (fs BoltDB) Close()

func (BoltDB) Get

func (fs BoltDB) Get(key []byte) (val []byte)

func (BoltDB) Remove

func (fs BoltDB) Remove(key []byte) error

func (BoltDB) Set

func (fs BoltDB) Set(key []byte, val []byte) error

type Constants

type Constants struct {
	SyncInterval                   time.Duration
	SuppressionInterval            time.Duration
	SyncIntervalJitter             float64 // percentage variance 0.00<=x<=1.00
	SuppressionIntervalJitter      float64 // percentage variance 0.00<=x<=1.00
	DataInterestLifeTime           time.Duration
	DataInterestRetries            uint // 0 = no retry
	DataPacketFreshness            time.Duration
	SyncInterestLifeTime           time.Duration
	DataComponent                  enc.Component
	SyncComponent                  enc.Component
	MaxConcurrentDataInterests     int32 // 0 = inf
	InitialFetchQueueSize          uint  // only helps to mitigate allocation resizing
	InitialMissingChannelSize      uint  // only helps to mitigate allocation resizing
	InitialStatusChangeChannelSize uint  // only helps to mitigate allocation resizing
	HeartbeatsToRenew              uint
	HeartbeatsToExpire             uint
	TrackRate                      time.Duration
	HeartbeatRate                  time.Duration
	MonitorInterval                time.Duration
}

func GetDefaultConstants

func GetDefaultConstants() *Constants

type Core

type Core interface {
	Listen()
	Activate(bool)
	Shutdown()
	Update(enc.Name, uint64)
	StateVector() *StateVector
	FeedInterest(ndn.Interest, enc.Wire, enc.Wire, ndn.ReplyFunc, time.Time)
	Subscribe() chan SyncUpdate
}

func NewCore

func NewCore(app *eng.Engine, config interface{}, constants *Constants) Core

type Database

type Database interface {
	Get([]byte) []byte
	Set([]byte, []byte) error
	Remove([]byte) error
	Close()
}

type HandlingOption

type HandlingOption int
const (
	NoHandling            HandlingOption = 0
	SourceCentricHandling HandlingOption = 1
	EqualTrafficHandling  HandlingOption = 2
)

type HealthConfig

type HealthConfig struct {
	Source               enc.Name
	GroupPrefix          enc.Name
	FormalEncoding       bool
	EfficientSuppression bool
}

type HealthSync

type HealthSync interface {
	Listen()
	Activate(bool)
	Shutdown()
	// TODO: NeedStatus + PublishStatus (publish/pull at a rate)
	Core() Core
	Tracker() Tracker
}

func NewHealthSync

func NewHealthSync(app *eng.Engine, config *HealthConfig, constants *Constants) HealthSync

type MissingData

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

type NamingScheme

type NamingScheme int
const (
	SourceOrientedNaming     NamingScheme = 0
	BareSourceOrientedNaming NamingScheme = 1
	GroupOrientedNaming      NamingScheme = 2
)

type NativeConfig

type NativeConfig struct {
	Source               enc.Name
	GroupPrefix          enc.Name
	NamingScheme         NamingScheme
	HandlingOption       HandlingOption
	StoragePath          string
	DataCallback         func(source enc.Name, seqno uint64, data ndn.Data)
	FormalEncoding       bool
	EfficientSuppression bool
}

func GetBasicNativeConfig

func GetBasicNativeConfig(source enc.Name, group enc.Name, callback func(source enc.Name, seqno uint64, data ndn.Data)) *NativeConfig

type NativeSync

type NativeSync interface {
	Listen()
	Activate(bool)
	Shutdown()
	NeedData(enc.Name, uint64)
	PublishData([]byte)
	FeedInterest(ndn.Interest, enc.Wire, enc.Wire, ndn.ReplyFunc, time.Time)
	Core() Core
}

func NewNativeSync

func NewNativeSync(app *eng.Engine, config *NativeConfig, constants *Constants) NativeSync

type OneStateCoreConfig

type OneStateCoreConfig struct {
	SyncPrefix     enc.Name
	FormalEncoding bool
}

type Scheduler

type Scheduler interface {
	ApplyBounds(time.Duration, time.Duration)
	Start(bool)
	Stop()
	Skip()
	Reset()
	Set(time.Duration)
	TimeLeft() time.Duration
}

func NewScheduler

func NewScheduler(function func()) Scheduler

type SharedConfig

type SharedConfig struct {
	Source               enc.Name
	GroupPrefix          enc.Name
	HandlingOption       HandlingOption
	StoragePath          string
	DataCallback         func(enc.Name, uint64, ndn.Data)
	FormalEncoding       bool
	EfficientSuppression bool
	// high-level only
	CacheOthers bool
}

func GetBasicSharedConfig

func GetBasicSharedConfig(source enc.Name, group enc.Name, callback func(source enc.Name, seqno uint64, data ndn.Data)) *SharedConfig

type SharedSync

type SharedSync interface {
	Listen()
	Activate(bool)
	Shutdown()
	NeedData(enc.Name, uint64, bool)
	PublishData([]byte)
	FeedInterest(ndn.Interest, enc.Wire, enc.Wire, ndn.ReplyFunc, time.Time)
	Core() Core
}

func NewSharedSync

func NewSharedSync(app *eng.Engine, config *SharedConfig, constants *Constants) SharedSync

type StateVector

type StateVector struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

func CopyStateVector

func CopyStateVector(sv StateVector) *StateVector

func NewStateVector

func NewStateVector() *StateVector

func ParseStateVector

func ParseStateVector(reader enc.ParseReader, formal bool) (*StateVector, error)

func (*StateVector) Encode

func (sv *StateVector) Encode(formal bool) enc.Wire

func (*StateVector) Entries

func (sv *StateVector) Entries() *nm.NameMap[uint64]

func (*StateVector) Get

func (sv *StateVector) Get(dsstr string) uint64

func (*StateVector) LastUpdated

func (sv *StateVector) LastUpdated(dsstr string) time.Time

func (*StateVector) Len

func (sv *StateVector) Len() int

func (*StateVector) Set

func (sv *StateVector) Set(dsstr string, dsname enc.Name, seqno uint64, old bool)

func (*StateVector) String

func (sv *StateVector) String() string

func (*StateVector) Sum

func (sv *StateVector) Sum() uint64

func (*StateVector) Update

func (sv *StateVector) Update(dsstr string)

type Status

type Status int
const (
	Unseen  Status = 0
	Expired Status = 1
	Renewed Status = 2
)

type StatusChange

type StatusChange struct {
	Node      string
	OldStatus Status
	NewStatus Status
}

type SyncUpdate

type SyncUpdate []MissingData

type Tracker

type Tracker interface {
	Reset(string)
	Detect()
	Status(string) Status
	UntilBeat() time.Duration
	Chan() chan StatusChange
}

func NewTracker

func NewTracker(src string, cs *Constants) Tracker

type TwoStateCoreConfig

type TwoStateCoreConfig struct {
	SyncPrefix           enc.Name
	FormalEncoding       bool
	EfficientSuppression bool
}

Jump to

Keyboard shortcuts

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