Documentation
¶
Overview ¶
gofiledb package provides an interface between Go applications and the linux-based file system so that the filesystem can be used as a database or a caching layer.
Index ¶
- Constants
- Variables
- func Initialize(p ClientInitOptions) error
- func IsNotExist(err error) bool
- func Repartition(params RepartitionParams) error
- type BoolAtomic
- type Client
- func (c *Client) AddCollection(_p CollectionProps) error
- func (c *Client) AddIndex(collectionName string, fieldLocator string) error
- func (c *Client) Destroy() error
- func (c *Client) FlushAll() error
- func (c *Client) Get(collectionName string, k Key) ([]byte, error)
- func (c *Client) GetFile(collectionName string, k Key) (*os.File, error)
- func (c *Client) GetIfExist(collectionName string, k Key) ([]byte, error)
- func (c *Client) GetIntoWriter(collectionName string, k Key, dest io.Writer) error
- func (c *Client) GetNewEntityID(collection string) (Key, error)
- func (c *Client) GetStruct(collectionName string, k Key, dest interface{}) error
- func (c *Client) GetStructIfExists(collectionName string, k Key, dest interface{}) (bool, error)
- func (c *Client) IsCollectionExist(collectionName string) (bool, error)
- func (c *Client) RemoveCollection(collectionName string) error
- func (c *Client) SaveNewEntity(collection string, entity interface{}) (Key, error)
- func (c *Client) Search(collectionName string, query string) (SearchResponse, error)
- func (c *Client) Set(collectionName string, k Key, data []byte) error
- func (c *Client) SetStruct(collectionName string, k Key, v interface{}) error
- type ClientInitOptions
- type ClientParams
- type CollectionProps
- type Key
- type RepartitionParams
- type SearchResponse
Constants ¶
View Source
const ( ENCODING_NONE uint = collection.ENCODING_NONE ENCODING_JSON uint = collection.ENCODING_JSON ENCODING_GOB uint = collection.ENCODING_GOB )
View Source
const DEFAULT_CLIENT_NUM_PARTITIONS int = 2
Variables ¶
View Source
var ErrClientAlreadyInitialized error = fmt.Errorf("Attempted to initialie GoFileDb client more than once")
Errors
View Source
var ErrClientNotInitialized error = fmt.Errorf("GoFiledb client fetched called without initializing the client")
View Source
var ErrCollectionIsExist = collection.ErrCollectionIsExist
View Source
var ErrCollectionIsNotExist = collection.ErrCollectionIsNotExist
View Source
var ErrIndexNotImplemented = collection.ErrIndexNotImplemented
View Source
var ErrIsRepartitioning = fmt.Errorf("The system is already busy repartitioning a collection. Please try again in a while.")
Functions ¶
func Initialize ¶
func Initialize(p ClientInitOptions) error
Initialize setsup the package for use by an appliction. This should be called before the client can be used.
func IsNotExist ¶
func Repartition ¶
func Repartition(params RepartitionParams) error
Types ¶
type BoolAtomic ¶
func (*BoolAtomic) CompareAndSet ¶
func (a *BoolAtomic) CompareAndSet(v bool) bool
func (*BoolAtomic) GetVal ¶
func (a *BoolAtomic) GetVal() bool
func (*BoolAtomic) SetVal ¶
func (a *BoolAtomic) SetVal(v bool)
type Client ¶
type Client struct { ClientParams // contains filtered or unexported fields }
Client is the primary object that the external application interacts with while saving or fetching data
func GetClient ¶
func GetClient() *Client
GetClient returns the current instance of the client for the application. It panics if the client has not been initialized.
func (*Client) AddCollection ¶
func (c *Client) AddCollection(_p CollectionProps) error
func (*Client) GetIfExist ¶
func (*Client) GetIntoWriter ¶
func (*Client) GetNewEntityID ¶
GetNewEntityID generates a unique pk.ID for the given collection
func (*Client) GetStructIfExists ¶
func (*Client) IsCollectionExist ¶
func (*Client) RemoveCollection ¶
func (*Client) SaveNewEntity ¶
SaveNewEntity saves a new enity
type ClientInitOptions ¶
type ClientParams ¶
type ClientParams struct {
// contains filtered or unexported fields
}
func NewClientParams ¶
func NewClientParams(documentRoot string) ClientParams
func (*ClientParams) GobDecode ¶
func (p *ClientParams) GobDecode(b []byte) error
func (ClientParams) GobEncode ¶
func (p ClientParams) GobEncode() ([]byte, error)
type CollectionProps ¶
type CollectionProps collection.CollectionProps
type RepartitionParams ¶
Click to show internal directories.
Click to hide internal directories.