config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Context *common.Context

	// Callback is the callback for the motor
	Callback common.NodeCallback

	// GroupIDs is the list of peer ids for the node
	GroupIDs []party.ID

	// SelfPartyID is the party id for the node
	SelfPartyID party.ID

	// PeerType is the type of peer
	PeerType types.PeerType
}

Config is the configuration for the node

func DefaultConfig

func DefaultConfig(ctx *common.Context) *Config

DefaultConfig returns the default configuration

func (*Config) Apply

func (c *Config) Apply(opts ...Option) error

Apply applies the options to the configuration

func (*Config) IsLocal

func (c *Config) IsLocal() bool

IsLocal returns true if the node is local

func (*Config) IsMotor

func (c *Config) IsMotor() bool

IsMotor returns true if the node is a motor

type Option

type Option func(*Config) error

Option is a function that configures a Node

func WithGroupIds

func WithGroupIds(partyIds ...party.ID) Option

WithGroupIds sets the peer ids for the node

func WithNodeCallback

func WithNodeCallback(callback common.NodeCallback) Option

WithNodeCallback sets the callback for the motor

func WithPartyId

func WithPartyId(partyId string) Option

WithPartyId sets the party id for the node. This is to be replaced by the User defined label for the device

func WithPeerType

func WithPeerType(peerType types.PeerType) Option

WithPeerType sets the type of peer

type StoreType added in v0.3.0

type StoreType string

StoreType is the type of a store

const (
	// DB_EVENT_LOG_STORE is a store that stores events
	DB_EVENT_LOG_STORE StoreType = "eventlog"

	// DB_KEY_VALUE_STORE is a store that stores key-value pairs
	DB_KEY_VALUE_STORE StoreType = "keyvalue"

	// DB_DOCUMENT_STORE is a store that stores documents
	DB_DOCUMENT_STORE StoreType = "docstore"
)

func (StoreType) String added in v0.3.0

func (st StoreType) String() string

A method of the StoreType type.

Jump to

Keyboard shortcuts

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