Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownEntity is returned for requests to load an entity // that does not exist. ErrUnknownEntity = errors.New("The specified entity does not exist") // ErrUnknownGroup is returned for requests to load a group // that does not exist. ErrUnknownGroup = errors.New("The specified group does not exist") // ErrUnknownDatabase is returned for an attempt to create a // new database that hasn't been registered. ErrUnknownDatabase = errors.New("The specified database does not exist") // ErrInternalError is used for all other errors that occur // within a database implementation. ErrInternalError = errors.New("The database has encountered an internal error") // ErrBadSearch is returned when a search request cannot be // filled for some reason. ErrBadSearch = errors.New("The provided SearchRequest is invalid") )
Functions ¶
func FireEvent ¶ added in v0.0.12
func FireEvent(e Event)
FireEvent fires an event to all callbacks.
func GetBackendList ¶
func GetBackendList() []string
GetBackendList returns a string list of the backends that are available
func Register ¶ added in v0.0.10
Register takes in a name of the database to register and a function signature to bind to that name.
func RegisterCallback ¶ added in v0.0.12
RegisterCallback takes a callback name and handle and registers them for later calling.
Types ¶
type Callback ¶ added in v0.0.12
type Callback func(Event)
Callback is a function type registered by an external customer that is interested in some change that might happen in the storage system. These are returned with a DBEvent populated of whether or not the event pertained to an entity or a group, and the relavant primary key.
type DB ¶
type DB interface { // Entity handling DiscoverEntityIDs() ([]string, error) LoadEntity(string) (*pb.Entity, error) SaveEntity(*pb.Entity) error DeleteEntity(string) error NextEntityNumber() (int32, error) SearchEntities(SearchRequest) ([]*pb.Entity, error) // Group handling DiscoverGroupNames() ([]string, error) LoadGroup(string) (*pb.Group, error) SaveGroup(*pb.Group) error DeleteGroup(string) error NextGroupNumber() (int32, error) SearchGroups(SearchRequest) ([]*pb.Group, error) }
DB specifies the methods that a DB engine must provide.
type Event ¶ added in v0.0.12
Event is a type of message that can be fed to callbacks describing the event and the key of the thing that happened.
type SearchRequest ¶ added in v0.0.12
type SearchRequest struct {
Expression string
}
SearchRequest is an expression that can be interpreted by the default util search system, or translated by a storage layer to provide a more optimized searching experience.
Directories
¶
Path | Synopsis |
---|---|
Package memdb is an entirely in-memory database with no persistence and no concurrency guarantees.
|
Package memdb is an entirely in-memory database with no persistence and no concurrency guarantees. |
Package protodb is one of the simplest databases that just reads and writes protos to the local disk.
|
Package protodb is one of the simplest databases that just reads and writes protos to the local disk. |
Package util handles synthetic functions that aren't implemented natively on a datastore.
|
Package util handles synthetic functions that aren't implemented natively on a datastore. |