Documentation ¶
Index ¶
- Constants
- Variables
- type AssociateGormResult
- type BlockstoreLevel
- func (b *BlockstoreLevel) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (b *BlockstoreLevel) Clear() error
- func (b *BlockstoreLevel) Close() error
- func (b *BlockstoreLevel) Delete(ctx context.Context, c cid.Cid) error
- func (b *BlockstoreLevel) Get(ctx context.Context, c cid.Cid) ([]byte, error)
- func (b *BlockstoreLevel) Has(ctx context.Context, c cid.Cid) (bool, error)
- func (b *BlockstoreLevel) IsEmpty() (bool, error)
- func (b *BlockstoreLevel) Open() error
- func (b *BlockstoreLevel) Partition(tenant string) (*BlockstoreLevel, error)
- func (b *BlockstoreLevel) Put(ctx context.Context, c cid.Cid, block []byte) error
- func (b *BlockstoreLevel) PutMany(ctx context.Context, blocks map[cid.Cid][]byte) error
- type DataFilter
- type DataStoreLevel
- func (d *DataStoreLevel) Clear(ctx context.Context) error
- func (d *DataStoreLevel) Close() error
- func (d *DataStoreLevel) Delete(ctx context.Context, tenant, messageCid, dataCid string) error
- func (d *DataStoreLevel) Get(ctx context.Context, tenant, messageCid, dataCid string) (*GetResult, error)
- func (d *DataStoreLevel) Open() error
- func (d *DataStoreLevel) Put(ctx context.Context, tenant, messageCid, dataCid string, dataReader io.Reader) (*PutResult, error)
- type DataStoreLevelConfig
- type DataStoreSQL
- func (dss *DataStoreSQL) Associate(tenant string, messageCid string, dataCid string) (*AssociateGormResult, error)
- func (dss *DataStoreSQL) Clear() error
- func (dss *DataStoreSQL) Close() error
- func (dss *DataStoreSQL) Delete(tenant string, messageCid string, dataCid string) error
- func (dss *DataStoreSQL) Get(tenant string, messageCid string, dataCid string) (string, int64, io.Reader, error)
- func (dss *DataStoreSQL) Open() error
- func (dss *DataStoreSQL) Put(tenant string, messageCid string, dataCid string, dataStream io.Reader) (*PutGormResult, error)
- type EqualFilter
- type EventLogSQL
- func (els *EventLogSQL) Append(tenant string, messageCid string, indexes KeyValues) error
- func (els *EventLogSQL) Clear() error
- func (els *EventLogSQL) Close() error
- func (els *EventLogSQL) DeleteEventsByCid(tenant string, messageCids []string) error
- func (els *EventLogSQL) GetEvents(tenant string, options *EventOptions) ([]string, error)
- func (els *EventLogSQL) Open() error
- func (els *EventLogSQL) QueryEvents(tenant string, filters []DataFilter, options *EventOptions) ([]string, error)
- type EventOptions
- type Filter
- type GenericMessage
- type GetGormResult
- type GetResult
- type GormMessageStore
- func (mss *GormMessageStore) Clear() error
- func (mss *GormMessageStore) Close() error
- func (mss *GormMessageStore) Delete(tenant string, cidString string, options *MessageStoreOptions) error
- func (mss *GormMessageStore) Get(tenant string, messageCid string) (interface{}, error)
- func (mss *GormMessageStore) Open() error
- func (mss *GormMessageStore) Put(tenant string, message GenericMessage, indexes KeyValues, ...) error
- func (mss *GormMessageStore) Query(tenant string, filters []DataFilter, messageSort *MessageSort, ...) ([]GenericMessage, string, error)
- type IndexLevel
- func (il *IndexLevel) Clear() error
- func (il *IndexLevel) Close() error
- func (il *IndexLevel) Delete(tenant string, itemId string, options *IndexLevelOptions) error
- func (il *IndexLevel) Put(tenant string, itemId string, indexes KeyValues, options *IndexLevelOptions) error
- func (il *IndexLevel) Query(tenant string, filters []Filter, queryOptions QueryOptions, ...) ([]string, error)
- type IndexLevelConfig
- type IndexLevelOptions
- type IndexedItem
- type KeyValues
- type LevelWrapper
- func (lw *LevelWrapper) Batch(operations []LevelWrapperBatchOperation, options *LevelWrapperOptions) error
- func (lw *LevelWrapper) Clear() error
- func (lw *LevelWrapper) Close() error
- func (lw *LevelWrapper) Delete(key string, options *LevelWrapperOptions) error
- func (lw *LevelWrapper) Get(key string, options *LevelWrapperOptions) ([]byte, error)
- func (lw *LevelWrapper) Has(key string, options *LevelWrapperOptions) (bool, error)
- func (lw *LevelWrapper) IsEmpty(options *LevelWrapperOptions) (bool, error)
- func (lw *LevelWrapper) Iterator(iterOptions *LevelWrapperIteratorOptions, options *LevelWrapperOptions) (iterator.Iterator, error)
- func (lw *LevelWrapper) Keys(options *LevelWrapperOptions) (iterator.Iterator, error)
- func (lw *LevelWrapper) Open() error
- func (lw *LevelWrapper) Partition(name string) (*LevelWrapper, error)
- func (lw *LevelWrapper) Put(key string, value []byte, options *LevelWrapperOptions) error
- type LevelWrapperBatchOperation
- type LevelWrapperConfig
- type LevelWrapperIteratorOptions
- type LevelWrapperOptions
- type MessageSort
- type MessageStoreLevel
- func (msl *MessageStoreLevel) Clear() error
- func (msl *MessageStoreLevel) Close() error
- func (msl *MessageStoreLevel) Delete(tenant, cidString string, options *MessageStoreOptions) error
- func (msl *MessageStoreLevel) Get(tenant, cidString string, options *MessageStoreOptions) (GenericMessage, error)
- func (msl *MessageStoreLevel) Open() error
- func (msl *MessageStoreLevel) Put(tenant string, message GenericMessage, indexes KeyValues, ...) error
- func (msl *MessageStoreLevel) Query(tenant string, filters []Filter, messageSort *MessageSort, ...) ([]GenericMessage, string, error)
- type MessageStoreLevelConfig
- type MessageStoreOptions
- type MessageStoreSQL
- type MessageStoreSQLConfig
- type Pagination
- type PutGormResult
- type PutResult
- type QueryOptions
- type RangeFilter
- type SortDirection
Constants ¶
const ( INDEX_SUBLEVEL_NAME = "index" DELIMITER = "\x00" NEGATIVE_PREFIX = "!" NEGATIVE_OFFSET = int64(^uint64(0) >> 1) MAX_INT_STRING_LEN = 19 // Length of string representation of max int64 )
const ( SortDirectionAscending = "ascending" SortDirectionDescending = "descending" )
Variables ¶
var PlaceholderValue = []byte{0}
PlaceholderValue is used as a placeholder value for reference counting
Functions ¶
This section is empty.
Types ¶
type AssociateGormResult ¶ added in v0.1.6
type BlockstoreLevel ¶
type BlockstoreLevel struct {
// contains filtered or unexported fields
}
BlockstoreLevel implements the Blockstore interface using LevelDB
func NewBlockstoreLevel ¶
func NewBlockstoreLevel(path string) (*BlockstoreLevel, error)
NewBlockstoreLevel creates a new BlockstoreLevel
func (*BlockstoreLevel) AllKeysChan ¶
func (b *BlockstoreLevel) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
AllKeysChan returns a channel of all CIDs in the database
func (*BlockstoreLevel) Clear ¶
func (b *BlockstoreLevel) Clear() error
Clear deletes all entries in the database
func (*BlockstoreLevel) Delete ¶
func (b *BlockstoreLevel) Delete(ctx context.Context, c cid.Cid) error
Delete removes a block from the database
func (*BlockstoreLevel) Get ¶
func (b *BlockstoreLevel) Get(ctx context.Context, c cid.Cid) ([]byte, error)
Get retrieves a block from the database
func (*BlockstoreLevel) Has ¶
func (b *BlockstoreLevel) Has(ctx context.Context, c cid.Cid) (bool, error)
Has checks if a block exists in the database
func (*BlockstoreLevel) IsEmpty ¶
func (b *BlockstoreLevel) IsEmpty() (bool, error)
IsEmpty checks if the database is empty
func (*BlockstoreLevel) Partition ¶
func (b *BlockstoreLevel) Partition(tenant string) (*BlockstoreLevel, error)
Add a Partition method to BlockstoreLevel
type DataFilter ¶ added in v0.1.6
type DataStoreLevel ¶
type DataStoreLevel struct {
// contains filtered or unexported fields
}
DataStoreLevel is a simple implementation of DataStore that works in both the browser and server-side. Leverages LevelDB under the hood.
It has the following structure (`+` represents a sublevel and `->` represents a key->value pair):
'data' + <tenant> + <dataCid> -> <data> 'references' + <tenant> + <dataCid> + <messageCid> -> PlaceholderValue
This allows for the <data> to be shared for everything that uses the same <dataCid> while also making sure that the <data> can only be deleted if there are no <messageCid> for any <tenant> still using it.
func NewDataStoreLevel ¶
func NewDataStoreLevel(config DataStoreLevelConfig) (*DataStoreLevel, error)
NewDataStoreLevel creates a new instance of DataStoreLevel
func (*DataStoreLevel) Clear ¶
func (d *DataStoreLevel) Clear(ctx context.Context) error
Clear deletes everything in the store
func (*DataStoreLevel) Delete ¶
func (d *DataStoreLevel) Delete(ctx context.Context, tenant, messageCid, dataCid string) error
Delete removes the reference and deletes data if it's no longer referenced
func (*DataStoreLevel) Get ¶
func (d *DataStoreLevel) Get(ctx context.Context, tenant, messageCid, dataCid string) (*GetResult, error)
Get retrieves the data if the caller has access
func (*DataStoreLevel) Open ¶
func (d *DataStoreLevel) Open() error
Open opens the datastore (no-op for LevelDB)
type DataStoreLevelConfig ¶
type DataStoreLevelConfig struct {
BlockstoreLocation string
}
DataStoreLevelConfig holds configuration options for DataStoreLevel
type DataStoreSQL ¶ added in v0.1.6
type DataStoreSQL struct {
// contains filtered or unexported fields
}
func NewDataStoreSQL ¶ added in v0.1.6
func NewDataStoreSQL(config MessageStoreSQLConfig) (*DataStoreSQL, error)
func (*DataStoreSQL) Associate ¶ added in v0.1.6
func (dss *DataStoreSQL) Associate(tenant string, messageCid string, dataCid string) (*AssociateGormResult, error)
func (*DataStoreSQL) Clear ¶ added in v0.1.6
func (dss *DataStoreSQL) Clear() error
func (*DataStoreSQL) Close ¶ added in v0.1.6
func (dss *DataStoreSQL) Close() error
func (*DataStoreSQL) Delete ¶ added in v0.1.6
func (dss *DataStoreSQL) Delete(tenant string, messageCid string, dataCid string) error
func (*DataStoreSQL) Open ¶ added in v0.1.6
func (dss *DataStoreSQL) Open() error
func (*DataStoreSQL) Put ¶ added in v0.1.6
func (dss *DataStoreSQL) Put(tenant string, messageCid string, dataCid string, dataStream io.Reader) (*PutGormResult, error)
type EqualFilter ¶
type EqualFilter interface{}
type EventLogSQL ¶ added in v0.1.6
type EventLogSQL struct {
// contains filtered or unexported fields
}
func NewEventLogSQL ¶ added in v0.1.6
func NewEventLogSQL(config MessageStoreSQLConfig) (*EventLogSQL, error)
func (*EventLogSQL) Append ¶ added in v0.1.6
func (els *EventLogSQL) Append(tenant string, messageCid string, indexes KeyValues) error
func (*EventLogSQL) Clear ¶ added in v0.1.6
func (els *EventLogSQL) Clear() error
func (*EventLogSQL) Close ¶ added in v0.1.6
func (els *EventLogSQL) Close() error
func (*EventLogSQL) DeleteEventsByCid ¶ added in v0.1.6
func (els *EventLogSQL) DeleteEventsByCid(tenant string, messageCids []string) error
func (*EventLogSQL) GetEvents ¶ added in v0.1.6
func (els *EventLogSQL) GetEvents(tenant string, options *EventOptions) ([]string, error)
func (*EventLogSQL) Open ¶ added in v0.1.6
func (els *EventLogSQL) Open() error
func (*EventLogSQL) QueryEvents ¶ added in v0.1.6
func (els *EventLogSQL) QueryEvents(tenant string, filters []DataFilter, options *EventOptions) ([]string, error)
type EventOptions ¶ added in v0.1.6
type EventOptions struct {
Cursor string
}
type GenericMessage ¶
type GenericMessage interface{}
type GetGormResult ¶ added in v0.1.6
type GetResult ¶
type GetResult struct { DataCid string DataSize uint64 DataReader io.ReadCloser }
GetResult is the result of a Get operation
type GormMessageStore ¶ added in v0.1.6
type GormMessageStore struct {
// contains filtered or unexported fields
}
func NewMessageStoreSQL ¶ added in v0.1.6
func NewMessageStoreSQL(config MessageStoreSQLConfig) (*GormMessageStore, error)
func (*GormMessageStore) Clear ¶ added in v0.1.6
func (mss *GormMessageStore) Clear() error
func (*GormMessageStore) Close ¶ added in v0.1.6
func (mss *GormMessageStore) Close() error
func (*GormMessageStore) Delete ¶ added in v0.1.6
func (mss *GormMessageStore) Delete(tenant string, cidString string, options *MessageStoreOptions) error
func (*GormMessageStore) Get ¶ added in v0.1.6
func (mss *GormMessageStore) Get(tenant string, messageCid string) (interface{}, error)
func (*GormMessageStore) Open ¶ added in v0.1.6
func (mss *GormMessageStore) Open() error
func (*GormMessageStore) Put ¶ added in v0.1.6
func (mss *GormMessageStore) Put(tenant string, message GenericMessage, indexes KeyValues, options *MessageStoreOptions) error
func (*GormMessageStore) Query ¶ added in v0.1.6
func (mss *GormMessageStore) Query(tenant string, filters []DataFilter, messageSort *MessageSort, pagination *Pagination, options *MessageStoreOptions) ([]GenericMessage, string, error)
type IndexLevel ¶
type IndexLevel struct {
// contains filtered or unexported fields
}
func NewIndexLevel ¶
func NewIndexLevel(config IndexLevelConfig) (*IndexLevel, error)
func (*IndexLevel) Clear ¶
func (il *IndexLevel) Clear() error
func (*IndexLevel) Close ¶
func (il *IndexLevel) Close() error
func (*IndexLevel) Delete ¶
func (il *IndexLevel) Delete(tenant string, itemId string, options *IndexLevelOptions) error
func (*IndexLevel) Put ¶
func (il *IndexLevel) Put(tenant string, itemId string, indexes KeyValues, options *IndexLevelOptions) error
func (*IndexLevel) Query ¶
func (il *IndexLevel) Query(tenant string, filters []Filter, queryOptions QueryOptions, options *IndexLevelOptions) ([]string, error)
type IndexLevelConfig ¶
type IndexLevelConfig struct {
Location string
}
type IndexLevelOptions ¶
type IndexedItem ¶
type LevelWrapper ¶
type LevelWrapper struct {
// contains filtered or unexported fields
}
LevelWrapper provides a wrapper around LevelDB with partitioning support.
func NewLevelWrapper ¶
func NewLevelWrapper(config LevelWrapperConfig) *LevelWrapper
NewLevelWrapper creates a new LevelWrapper instance.
func (*LevelWrapper) Batch ¶
func (lw *LevelWrapper) Batch(operations []LevelWrapperBatchOperation, options *LevelWrapperOptions) error
Batch executes a batch of operations.
func (*LevelWrapper) Clear ¶
func (lw *LevelWrapper) Clear() error
Clear removes all entries from the database.
func (*LevelWrapper) Close ¶
func (lw *LevelWrapper) Close() error
Close closes the LevelDB database.
func (*LevelWrapper) Delete ¶
func (lw *LevelWrapper) Delete(key string, options *LevelWrapperOptions) error
Delete removes a key-value pair.
func (*LevelWrapper) Get ¶
func (lw *LevelWrapper) Get(key string, options *LevelWrapperOptions) ([]byte, error)
Get retrieves a value by key.
func (*LevelWrapper) Has ¶
func (lw *LevelWrapper) Has(key string, options *LevelWrapperOptions) (bool, error)
Has checks if a key exists.
func (*LevelWrapper) IsEmpty ¶
func (lw *LevelWrapper) IsEmpty(options *LevelWrapperOptions) (bool, error)
IsEmpty checks if the database is empty.
func (*LevelWrapper) Iterator ¶
func (lw *LevelWrapper) Iterator(iterOptions *LevelWrapperIteratorOptions, options *LevelWrapperOptions) (iterator.Iterator, error)
Iterator returns an iterator over key-value pairs with options.
func (*LevelWrapper) Keys ¶
func (lw *LevelWrapper) Keys(options *LevelWrapperOptions) (iterator.Iterator, error)
Keys returns an iterator over the keys.
func (*LevelWrapper) Partition ¶
func (lw *LevelWrapper) Partition(name string) (*LevelWrapper, error)
Partition creates a new LevelWrapper for a sublevel (partition).
func (*LevelWrapper) Put ¶
func (lw *LevelWrapper) Put(key string, value []byte, options *LevelWrapperOptions) error
Put stores a key-value pair.
type LevelWrapperBatchOperation ¶
LevelWrapperBatchOperation represents a batch operation.
type LevelWrapperConfig ¶
LevelWrapperConfig holds configuration for LevelWrapper.
type LevelWrapperIteratorOptions ¶
LevelWrapperIteratorOptions represents options for iterators.
type LevelWrapperOptions ¶
LevelWrapperOptions represents options for LevelWrapper methods.
type MessageSort ¶
type MessageSort struct { DateCreated *SortDirection DatePublished *SortDirection MessageTimestamp *SortDirection Property string // The property/column to sort by Direction string // The sort direction ("ASC" or "DESC") }
MessageSort specifies sorting options for messages
type MessageStoreLevel ¶
type MessageStoreLevel struct {
// contains filtered or unexported fields
}
MessageStoreLevel represents a message store using LevelDB
func NewMessageStoreLevel ¶
func NewMessageStoreLevel(config MessageStoreLevelConfig) (*MessageStoreLevel, error)
NewMessageStoreLevel creates a new MessageStoreLevel instance
func (*MessageStoreLevel) Clear ¶
func (msl *MessageStoreLevel) Clear() error
Clear removes all messages from the store
func (*MessageStoreLevel) Close ¶
func (msl *MessageStoreLevel) Close() error
Close closes the message store
func (*MessageStoreLevel) Delete ¶
func (msl *MessageStoreLevel) Delete(tenant, cidString string, options *MessageStoreOptions) error
Delete removes a message from the store
func (*MessageStoreLevel) Get ¶
func (msl *MessageStoreLevel) Get(tenant, cidString string, options *MessageStoreOptions) (GenericMessage, error)
Get retrieves a message by its CID
func (*MessageStoreLevel) Open ¶
func (msl *MessageStoreLevel) Open() error
Open opens the message store
func (*MessageStoreLevel) Put ¶
func (msl *MessageStoreLevel) Put(tenant string, message GenericMessage, indexes KeyValues, options *MessageStoreOptions) error
Put stores a new message in the store
func (*MessageStoreLevel) Query ¶
func (msl *MessageStoreLevel) Query(tenant string, filters []Filter, messageSort *MessageSort, pagination *Pagination, options *MessageStoreOptions) ([]GenericMessage, string, error)
Query retrieves messages based on filters and sorting options
type MessageStoreLevelConfig ¶
type MessageStoreLevelConfig struct { BlockstoreLocation string IndexLocation string CreateLevelDatabase func(string) (*LevelWrapper, error) }
MessageStoreLevelConfig holds configuration for MessageStoreLevel
type MessageStoreOptions ¶
MessageStoreOptions contains options for message store operations
type MessageStoreSQL ¶ added in v0.1.6
type MessageStoreSQL struct {
// contains filtered or unexported fields
}
MessageStoreSQL represents a message store using SQL database
type MessageStoreSQLConfig ¶ added in v0.1.6
MessageStoreSQLConfig holds configuration for MessageStoreSQL
type Pagination ¶
Pagination specifies pagination options
type PutGormResult ¶ added in v0.1.6
type QueryOptions ¶
type RangeFilter ¶
type RangeFilter map[string]interface{}
type SortDirection ¶
type SortDirection string
SortDirection represents the direction of sorting
const ( SortAscending SortDirection = "asc" SortDescending SortDirection = "desc" )
Sort direction constants