backend

package
v0.0.0-...-88bc37c Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package backend is a generated protocol buffer package.

It is generated from these files:

test.proto

It has these top-level messages:

Timestamp

Index

Constants

View Source
const DefaultBasePath = "/openvdc"

Variables

View Source
var ErrConnectionExists = errors.New("Connection is established")
View Source
var ErrConnectionNotReady = errors.New("Connection is not established yet.")
View Source
var ErrFindLastKey = func(key string) error {
	return fmt.Errorf("Unable to find znode with last key: %s", key)
}
View Source
var ErrUnknownKey = func(key string) error {
	return errors.New("Unknown key name: " + key)
}

Functions

func Filter

func Filter(pb proto.Message, field string, cb func(reflect.Value))

Types

type BackendConnection

type BackendConnection interface {
	Connect(dest ConnectionAddress) error
	Close() error
}

type Bolt

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

func NewBoltBackend

func NewBoltBackend() *Bolt

func (*Bolt) Close

func (b *Bolt) Close() error

func (*Bolt) Connect

func (b *Bolt) Connect(dest ConnectionAddress) error

func (*Bolt) Create

func (b *Bolt) Create(key string, value []byte) error

func (*Bolt) CreateWithID

func (b *Bolt) CreateWithID(key string, value []byte) (string, error)

func (*Bolt) Delete

func (b *Bolt) Delete(key string) error

func (*Bolt) Find

func (b *Bolt) Find(key string) ([]byte, error)

func (*Bolt) FindLastKey

func (b *Bolt) FindLastKey(prefixKey string) (string, error)

func (*Bolt) Keys

func (b *Bolt) Keys(parentKey string) (KeyIterator, error)

func (*Bolt) Update

func (b *Bolt) Update(key string, value []byte) error

type BoltDBPath

type BoltDBPath string

func (BoltDBPath) String

func (b BoltDBPath) String() string

type ClusterBackend

type ClusterBackend interface {
	BackendConnection
	Register(nodeID string, value []byte) error
	Find(nodeID string) ([]byte, error)
	UnRegister(nodeID string) error
}

type ConnectionAddress

type ConnectionAddress interface {
	// contains filtered or unexported methods
}

type KeyIterator

type KeyIterator interface {
	Next() bool
	Value() string
}

type MockClusterBackend

type MockClusterBackend struct{}

func (*MockClusterBackend) Close

func (m *MockClusterBackend) Close() error

func (*MockClusterBackend) Connect

func (m *MockClusterBackend) Connect(dest []string) error

func (*MockClusterBackend) Find

func (m *MockClusterBackend) Find(key string) ([]byte, error)

func (*MockClusterBackend) Register

func (m *MockClusterBackend) Register(key string, value []byte) error

type ModelBackend

type ModelBackend interface {
	BackendConnection
	Create(key string, value []byte) error
	CreateWithID(key string, value []byte) (string, error)
	Update(key string, value []byte) error
	Find(key string) ([]byte, error)
	Delete(key string) error
	Keys(parentKey string) (KeyIterator, error)
	FindLastKey(prefixKey string) (string, error)
}

type ModelSchema

type ModelSchema interface {
	Schema() SchemaHandler
}

type ModelWatcher

type ModelWatcher interface {
	Watch(key string) (WatchEvent, error)
}

type ProtoClusterBackend

type ProtoClusterBackend interface {
	Backend() ClusterBackend
	Register(nodeID string, value proto.Message) error
	Find(nodeID string, value proto.Message) error
	Unregister(nodeID string) error
}

ProtoClusterBackend is the ClusterBackend interface wrapper that accepts proto.Message instead of raw bytes.

func NewProtoClusterWrapper

func NewProtoClusterWrapper(bk ClusterBackend) ProtoClusterBackend

type ProtoClusterWrapper

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

func (*ProtoClusterWrapper) Backend

func (p *ProtoClusterWrapper) Backend() ClusterBackend

func (*ProtoClusterWrapper) Find

func (p *ProtoClusterWrapper) Find(nodeID string, v proto.Message) error

func (*ProtoClusterWrapper) Register

func (p *ProtoClusterWrapper) Register(key string, value proto.Message) error

func (*ProtoClusterWrapper) Unregister

func (p *ProtoClusterWrapper) Unregister(nodeID string) error

type ProtoFilter

type ProtoFilter interface {
	OnCreate(v proto.Message) error
	OnUpdate(v proto.Message) error
}

type ProtoModelBackend

type ProtoModelBackend interface {
	Backend() ModelBackend
	AddFilter(f ProtoFilter)
	Create(key string, value proto.Message) error
	CreateWithID(key string, value proto.Message) (string, error)
	Update(key string, value proto.Message) error
	Find(key string, v proto.Message) error
	Delete(key string) error
	Keys(parentKey string) (KeyIterator, error)
	FindLastKey(prefixKey string) (string, error)
	ModelWatcher
}

ProtoModelBackend is the ModelBackend interface wrapper that accepts proto.Message instead of raw bytes.

func NewProtoWrapper

func NewProtoWrapper(bk ModelBackend) ProtoModelBackend

type ProtoWrapper

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

func (*ProtoWrapper) AddFilter

func (p *ProtoWrapper) AddFilter(f ProtoFilter)

func (*ProtoWrapper) Backend

func (p *ProtoWrapper) Backend() ModelBackend

func (*ProtoWrapper) Create

func (p *ProtoWrapper) Create(key string, value proto.Message) error

func (*ProtoWrapper) CreateWithID

func (p *ProtoWrapper) CreateWithID(key string, value proto.Message) (string, error)

func (*ProtoWrapper) Delete

func (p *ProtoWrapper) Delete(key string) error

func (*ProtoWrapper) Find

func (p *ProtoWrapper) Find(key string, v proto.Message) error

func (*ProtoWrapper) FindLastKey

func (p *ProtoWrapper) FindLastKey(prefixKey string) (string, error)

func (*ProtoWrapper) Keys

func (p *ProtoWrapper) Keys(parentKey string) (KeyIterator, error)

func (*ProtoWrapper) Update

func (p *ProtoWrapper) Update(key string, value proto.Message) error

func (*ProtoWrapper) Watch

func (p *ProtoWrapper) Watch(key string) (WatchEvent, error)

type SchemaHandler

type SchemaHandler interface {
	Install(subkeys []string) error
}

type Timestamp

type Timestamp struct {
	CreatedAt *google_protobuf.Timestamp `protobuf:"bytes,1,opt,name=created_at,json=createdAt" json:"created_at,omitempty"`
	UpdatedAt *google_protobuf.Timestamp `protobuf:"bytes,2,opt,name=updated_at,json=updatedAt" json:"updated_at,omitempty"`
}

func (*Timestamp) Descriptor

func (*Timestamp) Descriptor() ([]byte, []int)

func (*Timestamp) GetCreatedAt

func (m *Timestamp) GetCreatedAt() *google_protobuf.Timestamp

func (*Timestamp) GetUpdatedAt

func (m *Timestamp) GetUpdatedAt() *google_protobuf.Timestamp

func (*Timestamp) ProtoMessage

func (*Timestamp) ProtoMessage()

func (*Timestamp) Reset

func (m *Timestamp) Reset()

func (*Timestamp) String

func (m *Timestamp) String() string

type TimestampFilter

type TimestampFilter struct {
	Time time.Time
}

func (*TimestampFilter) OnCreate

func (f *TimestampFilter) OnCreate(v proto.Message) error

func (*TimestampFilter) OnUpdate

func (f *TimestampFilter) OnUpdate(v proto.Message) error

type WatchEvent

type WatchEvent int
const (
	EventErr WatchEvent = iota
	EventUnknown
	EventCreated
	EventDeleted
	EventModified
)

func (WatchEvent) String

func (e WatchEvent) String() string

type Zk

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

func NewZkBackend

func NewZkBackend() *Zk

func (*Zk) Close

func (z *Zk) Close() error

func (*Zk) Connect

func (z *Zk) Connect(dest ConnectionAddress) error

func (*Zk) Create

func (z *Zk) Create(key string, value []byte) error

func (*Zk) CreateWithID

func (z *Zk) CreateWithID(key string, value []byte) (string, error)

func (*Zk) Delete

func (z *Zk) Delete(key string) error

func (*Zk) Find

func (z *Zk) Find(key string) ([]byte, error)

func (*Zk) FindLastKey

func (z *Zk) FindLastKey(prefixKey string) (string, error)

func (*Zk) Keys

func (z *Zk) Keys(parentKey string) (KeyIterator, error)

func (*Zk) Schema

func (z *Zk) Schema() SchemaHandler

func (*Zk) Update

func (z *Zk) Update(key string, value []byte) error

func (*Zk) Watch

func (z *Zk) Watch(key string) (WatchEvent, error)

type ZkCluster

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

func NewZkClusterBackend

func NewZkClusterBackend() *ZkCluster

func (*ZkCluster) Close

func (z *ZkCluster) Close() error

func (*ZkCluster) Connect

func (z *ZkCluster) Connect(dest ConnectionAddress) error

func (*ZkCluster) Find

func (z *ZkCluster) Find(key string) (value []byte, err error)

func (*ZkCluster) Register

func (z *ZkCluster) Register(key string, value []byte) error

func (*ZkCluster) Schema

func (z *ZkCluster) Schema() SchemaHandler

func (*ZkCluster) UnRegister

func (z *ZkCluster) UnRegister(key string) error

type ZkEndpoint

type ZkEndpoint struct {
	Path  string
	Hosts []string // "host" or "host:port"
}

Implements pflag.Value and backend.ConnectionAddress

func (*ZkEndpoint) Set

func (ze *ZkEndpoint) Set(value string) error

func (*ZkEndpoint) String

func (ze *ZkEndpoint) String() string

func (ZkEndpoint) Type

func (ZkEndpoint) Type() string

Jump to

Keyboard shortcuts

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