adapter

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// EventAdd is the add event.
	EventAdd = EventType(iota + 1)
	// EventUpdate is the update event.
	EventUpdate
	// EventDelete is the delete event
	EventDelete
)
View Source
const (
	// BackendBTree indicates the btree-based backend.
	BackendBTree = BackendKind(iota)
	// BackendMySQL indicates the mysql-based backend.
	BackendMySQL
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	// EventCh returns a send-only channel to the users, so that users
	// can feed events to Etcd Adapter. Note this is a non-buffered channel.
	EventCh() chan<- []*Event
	// Serve accepts a net.Listener object and starts the Etcd V3 server.
	Serve(context.Context, net.Listener) error
	// Shutdown shuts the etcd adapter down.
	Shutdown(context.Context) error
}

func NewEtcdAdapter

func NewEtcdAdapter(opts *AdapterOptions) Adapter

NewEtcdAdapter new an etcd adapter instance.

type AdapterOptions

type AdapterOptions struct {
	Backend server.Backend
	// etcdserver.EtcdServer and KVServerBridge is an implementation of EtcdServerRegister
	EtcdServer EtcdServerRegister
}

type BackendKind

type BackendKind int

BackendKind is the type of backend.

type EtcdServerRegister

type EtcdServerRegister interface {
	// Implementation of the etcd grpc API for registration
	Register(server *grpc.Server)
}

type Event

type Event struct {
	// Key is the object key.
	Key string
	// Value is the serialized data.
	Value []byte
	// Type is the event type.
	Type EventType
}

Event contains a bunch of entities and the type of event.

type EventType

type EventType int

EventType is the type of event kind.

Jump to

Keyboard shortcuts

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