Documentation
¶
Index ¶
- func NewFakePebble() *fakePebble
- func NewFakePebbleIterator(data map[string][]byte) *fakePebbleIterator
- func NewPebbleClient(dir string) (*pebble.DB, error)
- type BadgerDB
- func (db *BadgerDB) Add(objectID string, propertyID string, data []byte) error
- func (db *BadgerDB) Delete(objectID string, propertyID string) error
- func (db *BadgerDB) Get(objectID string) (*Object, error)
- func (db *BadgerDB) Import(objectID string, properties map[string][]byte) (string, error)
- func (db *BadgerDB) Update(objectID string, propertyID string, data []byte) error
- type DB
- type DBSQLite
- func (db *DBSQLite) Add(objectID string, propertyID string, data []byte) error
- func (db *DBSQLite) Delete(objectID string, propertyID string) error
- func (db *DBSQLite) Get(objectID string) (*Object, error)
- func (db *DBSQLite) Import(objectID string, properties map[string][]byte) (string, error)
- func (db *DBSQLite) Update(objectID string, propertyID string, data []byte) error
- type NullDB
- func (db *NullDB) Add(objectID string, propertyID string, data []byte) error
- func (db *NullDB) Delete(objectID string, propertyID string) error
- func (db *NullDB) Get(objectID string) (*Object, error)
- func (db *NullDB) Import(objectID string, properties map[string][]byte) (string, error)
- func (db *NullDB) Update(objectID string, propertyID string, data []byte) error
- type Object
- type PebbleDB
- func (db *PebbleDB) Add(objectID string, propertyID string, data []byte) error
- func (db *PebbleDB) Delete(objectID string, propertyID string) error
- func (db *PebbleDB) Get(objectID string) (*Object, error)
- func (db *PebbleDB) Import(objectID string, properties map[string][]byte) (string, error)
- func (db *PebbleDB) Update(objectID string, propertyID string, data []byte) error
- type PebbleIterator
- type PebbleMinimal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFakePebble ¶
func NewFakePebble() *fakePebble
func NewFakePebbleIterator ¶
Types ¶
type BadgerDB ¶
type BadgerDB struct {
// contains filtered or unexported fields
}
BadgerDB implements the DB interface using BadgerDB
func NewBadgerDB ¶
NewBadgerDB creates new BadgerDB DB connection
type DB ¶
type DB interface { // Add an object to the DB. // Add(objectID string, propertyID string, data []byte) error Delete(objectID string, propertyID string) error Update(objectID string, propertyID string, data []byte) error // Import imports an entire object (basically objectID and property collection) Import(objectID string, properties map[string][]byte) (string, error) // Get entire object. Will return all properties for an object. Get(objectID string) (*Object, error) }
DB interface used to store the data *somewhere*
type DBSQLite ¶
type DBSQLite struct {
// contains filtered or unexported fields
}
DBSQLite implements the DB interface using SQLite
func NewDBSQLite ¶
NewDBSQLite creates new SQLite (modernc/sqlite) DB connection
func (*DBSQLite) Add ¶
Add is really an upsert now. Might refactor update to be removed Currently this is NOT thread safe... so as soon as we're dealing with 2 different objects this will blow up due to transaction within transaction. Need to investigate modernc/sqlite threadsafety. If I be naive and throw a lock around this then I can see definite lag on test clients and everything gets out of sync.
Will probably move all writing out to a separate goroutine and have the various processors just dump their changes onto a bufferless channel. Goroutine does write, signals back to caller (via another channel?) that write is done. Investigate... FIXME(kpfaulkner)
type NullDB ¶
type NullDB struct { }
Fake DB... just for testing wont do anything with the data.
type Object ¶
Object represents an object in the system. Its VERY basic. ObjectID (unique identifier) Map of propertyname to bytes. The caller can make the property names whatever they want... the server does not care (well shouldn't care... TBD)
type PebbleDB ¶
type PebbleDB struct {
// contains filtered or unexported fields
}
BadgerDB implements the DB interface using BadgerDB
func NewPebbleDB ¶
func NewPebbleDB(pdb PebbleMinimal) (*PebbleDB, error)
NewPebbleDB creates new BadgerDB DB connection
type PebbleIterator ¶
type PebbleIterator interface { First() bool Valid() bool Next() bool Key() []byte ValueAndErr() ([]byte, error) }
PebbleIterator... used for mocking in tests Is this a mistake?
type PebbleMinimal ¶
type PebbleMinimal interface { Set(key, value []byte, opts *pebble.WriteOptions) error NewIter(o *pebble.IterOptions) *pebble.Iterator }
PebbleMinimal is the minimal interface we use from Pebble Interface to help mock this out for testing.