util

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeAddrsEdge

func ComputeAddrsEdge(as []PeerAddr) uint64

func ComputeHeadsEdge

func ComputeHeadsEdge(hs []LogHead) uint64

func DefaultBoostrapPeers

func DefaultBoostrapPeers() []peer.AddrInfo

func FreeLocalAddr

func FreeLocalAddr() ma.Multiaddr

func GenerateRandomBytes

func GenerateRandomBytes(n int) []byte

func InstanceFromJSON

func InstanceFromJSON(b []byte, i interface{})

func JSONFromInstance

func JSONFromInstance(i interface{}) []byte

func LevelFromDebugFlag

func LevelFromDebugFlag(debug bool) logging.LogLevel

LevelFromDebugFlag returns the debug or info log level.

func MakeToken

func MakeToken(n int) string

func MustParseAddr

func MustParseAddr(str string) ma.Multiaddr

func NewBadgerDatastore

func NewBadgerDatastore(dirPath, name string, lowMem bool) (kt.TxnDatastoreExtended, error)

NewBadgerDatastore returns a badger based datastore.

func NewDatastore added in v0.0.2

func NewDatastore(repoPath string, opts *badger.Options) (kt.TxnDatastoreExtended, error)

NewDatastore returns a badger based datastore.

func ParseBootstrapPeers

func ParseBootstrapPeers(addrs []string) ([]peer.AddrInfo, error)

func SchemaFromInstance

func SchemaFromInstance(i interface{}, expandedStruct bool) *jsonschema.Schema

func SchemaFromSchemaString

func SchemaFromSchemaString(s string) *jsonschema.Schema

func SetJSONID

func SetJSONID(id core.InstanceID, json []byte) []byte

func SetJSONProperty

func SetJSONProperty(name string, value interface{}, json []byte) []byte

func SetLogLevels

func SetLogLevels(systems map[string]logging.LogLevel) error

SetLogLevels sets levels for the given systems.

func SetupDefaultLoggingConfig

func SetupDefaultLoggingConfig(file string) error

SetupDefaultLoggingConfig sets up a standard logging configuration.

func StopGRPCServer

func StopGRPCServer(server *grpc.Server)

func TCPAddrFromMultiAddr

func TCPAddrFromMultiAddr(maddr ma.Multiaddr) (addr string, err error)

Types

type LogHead

type LogHead struct {
	LogID peer.ID
	Head  thread.Head
}

type PeerAddr

type PeerAddr struct {
	PeerID peer.ID
	Addr   ma.Multiaddr
}

Jump to

Keyboard shortcuts

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