driver

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	// Open opens the driver
	Open() error
	// Read reads the node from unix like tree path
	Read(path string) ([]byte, error)
	// Write writes to designated location
	Write(path string, data []byte) error
	// Children returns the list of children for a path
	Children(path string) ([]string, error)
	// Delete deletes the node in path
	Delete(path string) error
	// Watch gets the value and watches for future changes
	Watch(path string) ([]byte, <-chan *Event, error)
	// Watch gets the children and watches for future changes
	WatchChildren(path string) ([]string, <-chan *Event, error)
	// Close shuts down the connection for the driver
	Close() error
}

Driver defines an interface for reading/writing data to data source

type Event

type Event struct {
	Type EventType
	P    string
	D    interface{}
	Err  error
}

Event is defined to wrap events emitted by the driver

func (*Event) Data

func (e *Event) Data() interface{}

func (*Event) Error

func (e *Event) Error() error

func (*Event) EventType

func (e *Event) EventType() EventType

EventType returns event type of the event

func (*Event) Path

func (e *Event) Path() string

Path returns the path of event

type EventType

type EventType uint64
const (
	EventCreated         EventType = 1
	EventDeleted         EventType = 2
	EventDataChanged     EventType = 3
	EventChildrenChanged EventType = 4
)

Driver Events

func (EventType) String

func (e EventType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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