Documentation ¶
Index ¶
- Constants
- Variables
- func CreateIndex(podName, collectionName, indexName string, indexType IndexType, fd *feed.API, ...) error
- type Batch
- func (b *Batch) Del(key string) ([][]byte, error)
- func (b *Batch) DelNumber(key float64) ([][]byte, error)
- func (b *Batch) Get(key string) ([][]byte, error)
- func (b *Batch) Put(key string, refValue []byte, apnd, memory bool) error
- func (b *Batch) PutNumber(key float64, refValue []byte, apnd, memory bool) error
- func (b *Batch) Write(podFile string) (*Manifest, error)
- type CIndex
- type DBSchema
- type DocBatch
- type Document
- func (d *Document) Count(dbName, expr string) (uint64, error)
- func (d *Document) CreateDocBatch(dbName string) (*DocBatch, error)
- func (d *Document) CreateDocumentDB(dbName string, indexes map[string]IndexType, mutable bool) error
- func (d *Document) Del(dbName, id string) error
- func (d *Document) DeleteDocumentDB(dbName string) error
- func (d *Document) DocBatchPut(docBatch *DocBatch, doc []byte, index int64) error
- func (d *Document) DocBatchWrite(docBatch *DocBatch, podFile string) error
- func (d *Document) DocFileIndex(dbName, podFile string) error
- func (d *Document) Find(dbName, expr string, limit int) ([][]byte, error)
- func (d *Document) Get(dbName, id string) ([]byte, error)
- func (d *Document) IsDBOpened(dbName string) bool
- func (d *Document) LoadDocumentDBSchemas() (map[string]DBSchema, error)
- func (d *Document) OpenDocumentDB(dbName string) error
- func (d *Document) Put(dbName string, doc []byte) error
- type DocumentDB
- type Entry
- type Index
- func (idx *Index) CountIndex() (uint64, error)
- func (idx *Index) Delete(key string) ([][]byte, error)
- func (idx *Index) DeleteIndex() error
- func (idx *Index) DeleteNumber(key float64) ([][]byte, error)
- func (idx *Index) Get(key string) ([][]byte, error)
- func (idx *Index) GetNumber(key float64) ([][]byte, error)
- func (idx *Index) NewIntIterator(start, end, limit int64) (*Iterator, error)
- func (idx *Index) NewStringIterator(start, end string, limit int64) (*Iterator, error)
- func (idx *Index) Put(key string, refValue []byte, idxType IndexType, apnd bool) error
- func (idx *Index) PutNumber(key float64, refValue []byte, idxType IndexType, apnd bool) error
- type IndexType
- type Iterator
- type KVCount
- type KVTable
- type KeyValue
- func (kv *KeyValue) CreateKVTable(name string, indexType IndexType) error
- func (kv *KeyValue) DeleteKVTable(name string) error
- func (kv *KeyValue) KVBatch(name string, columns []string) (*Batch, error)
- func (kv *KeyValue) KVBatchPut(batch *Batch, key string, value []byte) error
- func (kv *KeyValue) KVBatchWrite(batch *Batch) error
- func (kv *KeyValue) KVCount(name string) (*KVCount, error)
- func (kv *KeyValue) KVDelete(name, key string) ([]byte, error)
- func (kv *KeyValue) KVGet(name, key string) ([]string, []byte, error)
- func (kv *KeyValue) KVGetNext(name string) ([]string, string, []byte, error)
- func (kv *KeyValue) KVPut(name, key string, value []byte) error
- func (kv *KeyValue) KVSeek(name, start, end string, limit int64) (*Iterator, error)
- func (kv *KeyValue) LoadKVTables() (map[string][]string, error)
- func (kv *KeyValue) OpenKVTable(name string) error
- type Manifest
- type ManifestState
- type SIndex
Constants ¶
const ( DocumentFile = "document_dbs" DefaultIndexFieldName = "id" )
const ( LeafEntry = "L" IntermediateEntry = "I" )
const (
CSVHeaderKey = "__csv_header__"
)
Variables ¶
var ( ErrEmptyIndex = errors.New("empty Index") ErrEntryNotFound = errors.New("entry not found") ErrNoNextElement = errors.New("no next element") ErrNoManifestFound = errors.New("no Manifest found") ErrManifestUnmarshall = errors.New("could not unmarshall Manifest") ErrManifestCreate = errors.New("could not create new Manifest") ErrDeleteingIndex = errors.New("could not delete index") ErrIndexAlreadyPresent = errors.New("index already present") ErrIndexNotPresent = errors.New("index not present") ErrIndexNotSupported = errors.New("index not supported") ErrInvalidIndexType = errors.New("invalid index type") ErrKvTableAlreadyPresent = errors.New("kv table already present") ErrKVTableNotPresent = errors.New("kv table not present") ErrKVTableNotOpened = errors.New("kv table not opened") ErrKVInvalidIndexType = errors.New("kv invalid index type") ErrKVIndexTypeNotSupported = errors.New("kv index type not supported yet") ErrKVKeyNotANumber = errors.New("kv key not a number") ErrUnmarshallingDBSchema = errors.New("could not unmarshall document db schema") ErrMarshallingDBSchema = errors.New("could not marshall document db schema") ErrDocumentDBAlreadyPresent = errors.New("document db already present") ErrDocumentDBNotPresent = errors.New("document db not present") ErrDocumentDBNotOpened = errors.New("document db not opened") ErrDocumentDBAlreadyOpened = errors.New("document db already opened") ErrDocumentDBIndexFieldNotPresent = errors.New("document db index field not present") ErrModifyingImmutableDocDB = errors.New("trying to modify immutable document db") ErrInvalidOperator = errors.New("invalid operator") ErrDocumentNotPresent = errors.New("document not present") ErrInvalidDocumentId = errors.New("invalid document id") ErrReadOnlyIndex = errors.New("read only index") ErrCannotModifyImmutableIndex = errors.New("trying to modify immutable index") ErrCouldNotUpdatePostageBatch = errors.New("could not procure new postage batch") ErrUnknownJsonFormat = errors.New("unknown json format") )
var (
NoOfParallelWorkers = runtime.NumCPU() * 4
)
Functions ¶
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
type DBSchema ¶
type DBSchema struct { Name string `json:"name"` Mutable bool `json:"mutable"` SimpleIndexes []SIndex `json:"simple_indexes,omitempty"` MapIndexes []SIndex `json:"map_indexes,omitempty"` ListIndexes []SIndex `json:"list_indexes,omitempty"` CompoundIndexes []CIndex `json:"compound_indexes,omitempty"` }
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func NewDocumentStore ¶
func NewDocumentStore(podName string, fd *feed.API, ai *account.Info, user utils.Address, file *file.File, client blockstore.Client, logger logging.Logger) *Document
NewDocumentStore instantiates a document DB object through which all document DB are spawned.
func (*Document) Count ¶
Count counts the number of document in a document DB which matches a given expression
func (*Document) CreateDocBatch ¶
CreateDocBatch creates a batch index instead of normal index. This is used when doing a bulk insert.
func (*Document) CreateDocumentDB ¶
func (d *Document) CreateDocumentDB(dbName string, indexes map[string]IndexType, mutable bool) error
CreateDocumentDB creates a new document database and its related indexes.
func (*Document) Del ¶
Del deletes a specific document from a document database matching a document id.
func (*Document) DeleteDocumentDB ¶
DeleteDocumentDB a document DB, all its data and its related indxes.
func (*Document) DocBatchPut ¶
DocBatchPut is used to insert a single document to the batch index.
func (*Document) DocBatchWrite ¶
DocBatchWrite commits the batch index into the Swarm network.
func (*Document) DocFileIndex ¶
DocFileIndex indexes a existing json file in the pod with the document DB.
func (*Document) Find ¶
Find selects a number of rows from a document database matching an expression.
func (*Document) Get ¶
Get retrieves a specific document from a document database matching the dcument id.
func (*Document) IsDBOpened ¶
IsDBOpened is used to check if a document DB is opened or not.
func (*Document) LoadDocumentDBSchemas ¶
LoadDocumentDBSchemas loads the schema of all documents belonging to a pod.
func (*Document) OpenDocumentDB ¶
OpenDocumentDB open a document database and its related indexes.
type DocumentDB ¶
type DocumentDB struct {
// contains filtered or unexported fields
}
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func OpenIndex ¶
func OpenIndex(podName, collectionName, indexName string, fd *feed.API, ai *account.Info, user utils.Address, client blockstore.Client, logger logging.Logger) (*Index, error)
OpenIndex open the index and loas any index in to the memory.
func (*Index) CountIndex ¶
CountIndex counts the entries in an index.
func (*Index) DeleteIndex ¶
DeleteIndex delete the index from file and all its entries.
func (*Index) DeleteNumber ¶
DeleteNumber removes an entry from index where the key is of type number.
func (*Index) GetNumber ¶
GetNumber retrieves an element from the index where the key is of type number.
func (*Index) NewIntIterator ¶
NewIntIterator reates a new index iterator with start prefix, endPrefix and the limit to iterate.
func (*Index) NewStringIterator ¶
NewStringIterator creates a new iterator object which is used to create new index iterators.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
func (*Iterator) IntegerKey ¶
type KeyValue ¶
type KeyValue struct {
// contains filtered or unexported fields
}
func NewKeyValueStore ¶
func NewKeyValueStore(podName string, fd *feed.API, ai *account.Info, user utils.Address, client blockstore.Client, logger logging.Logger) *KeyValue
NewKeyValueStore is the main object used to do all operation on the key value tables.
func (*KeyValue) CreateKVTable ¶
CreateKVTable creates the key value table with a given index type.
func (*KeyValue) DeleteKVTable ¶
DeleteKVTable deletes a given key value table with all it index and data entries.
func (*KeyValue) KVBatchPut ¶
KVBatchPut inserts a key and value in to the memory for batch.
func (*KeyValue) KVBatchWrite ¶
KVBatchWrite commits all the batch entries in to the key value table.
func (*KeyValue) KVSeek ¶
KVSeek seek to given key with start prefix and prepare for iterating the table.
func (*KeyValue) LoadKVTables ¶
LoadKVTables Loads the list of KV tables.
func (*KeyValue) OpenKVTable ¶
OpenKVTable open a given key value table and loads the index.
type Manifest ¶
type ManifestState ¶
type ManifestState struct {
// contains filtered or unexported fields
}