db

package
v0.11.54 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: Apache-2.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const (
	FieldServiceEgress   = "egress"
	FieldServiceBinding  = "binding"
	FieldServiceEndpoint = "endpoint"
)
View Source
const (
	EntityTypeRouters      = "routers"
	FieldRouterFingerprint = "fingerprint"
)
View Source
const (
	EntityTypeServices             = "services"
	FieldServiceTerminatorStrategy = "terminatorStrategy"
)
View Source
const (
	EntityTypeTerminators  = "terminators"
	FieldTerminatorService = "service"
	FieldTerminatorRouter  = "router"
	FieldTerminatorBinding = "binding"
	FieldTerminatorAddress = "address"
	FieldTerminatorCost    = "cost"
	FieldServerPeerData    = "peerData"
)
View Source
const CurrentDbVersion = 3
View Source
const (
	FieldName = "name"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

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

func Open

func Open(path string) (*Db, error)

func (*Db) Close

func (db *Db) Close() error

func (*Db) RootBucket

func (db *Db) RootBucket(tx *bbolt.Tx) (*bbolt.Bucket, error)

func (*Db) Snapshot

func (db *Db) Snapshot(tx *bbolt.Tx) error

func (*Db) Update

func (db *Db) Update(fn func(tx *bbolt.Tx) error) error

func (*Db) View

func (db *Db) View(fn func(tx *bbolt.Tx) error) error

type Router

type Router struct {
	boltz.BaseExtEntity
	Name        string
	Fingerprint *string
}

func (*Router) GetEntityType

func (entity *Router) GetEntityType() string

func (*Router) LoadValues

func (entity *Router) LoadValues(_ boltz.CrudStore, bucket *boltz.TypedBucket)

func (*Router) SetValues

func (entity *Router) SetValues(ctx *boltz.PersistContext)

type RouterStore

type RouterStore interface {
	boltz.CrudStore
	GetNameIndex() boltz.ReadIndex
	LoadOneById(tx *bbolt.Tx, id string) (*Router, error)
	LoadOneByName(tx *bbolt.Tx, id string) (*Router, error)
}

type Service

type Service struct {
	boltz.BaseExtEntity
	Name               string
	TerminatorStrategy string
}

func (*Service) GetEntityType

func (entity *Service) GetEntityType() string

func (*Service) LoadValues

func (entity *Service) LoadValues(_ boltz.CrudStore, bucket *boltz.TypedBucket)

func (*Service) SetValues

func (entity *Service) SetValues(ctx *boltz.PersistContext)

type ServiceStore

type ServiceStore interface {
	GetNameIndex() boltz.ReadIndex
	LoadOneById(tx *bbolt.Tx, id string) (*Service, error)
	LoadOneByName(tx *bbolt.Tx, name string) (*Service, error)
	// contains filtered or unexported methods
}

type Stores

type Stores struct {
	Terminator TerminatorStore
	Router     RouterStore
	Service    ServiceStore
	// contains filtered or unexported fields
}

func InitStores

func InitStores(db boltz.Db) (*Stores, error)

func (*Stores) GetStoreForEntity

func (stores *Stores) GetStoreForEntity(entity boltz.Entity) boltz.CrudStore

func (*Stores) GetStoreList

func (stores *Stores) GetStoreList() []boltz.CrudStore

type Terminator

type Terminator struct {
	boltz.BaseExtEntity
	Service  string
	Router   string
	Binding  string
	Address  string
	Cost     uint16
	PeerData map[uint32][]byte
}

func (*Terminator) GetAddress

func (entity *Terminator) GetAddress() string

func (*Terminator) GetBinding

func (entity *Terminator) GetBinding() string

func (*Terminator) GetCost

func (entity *Terminator) GetCost() uint16

func (*Terminator) GetEntityType

func (entity *Terminator) GetEntityType() string

func (*Terminator) GetPeerData

func (entity *Terminator) GetPeerData() map[uint32][]byte

func (*Terminator) GetRouterId

func (entity *Terminator) GetRouterId() string

func (*Terminator) GetServiceId

func (entity *Terminator) GetServiceId() string

func (*Terminator) LoadValues

func (entity *Terminator) LoadValues(_ boltz.CrudStore, bucket *boltz.TypedBucket)

func (*Terminator) SetValues

func (entity *Terminator) SetValues(ctx *boltz.PersistContext)

type TerminatorStore

type TerminatorStore interface {
	boltz.CrudStore
	LoadOneById(tx *bbolt.Tx, id string) (*Terminator, error)
}

type TestContext

type TestContext struct {
	boltz.BaseTestContext
	// contains filtered or unexported fields
}

func NewTestContext

func NewTestContext(t *testing.T) *TestContext

func (*TestContext) GetDb

func (ctx *TestContext) GetDb() boltz.Db

func (*TestContext) GetStoreForEntity

func (ctx *TestContext) GetStoreForEntity(entity boltz.Entity) boltz.CrudStore

func (*TestContext) Init

func (ctx *TestContext) Init()

Jump to

Keyboard shortcuts

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