Documentation ¶
Overview ¶
Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- type Config
- type KeyWithVersion
- type Store
- func (s *Store) Close() error
- func (s *Store) Commit(blockNum uint64, txsData []*TxDataForProvenance) error
- func (s *Store) GetDeletedValues(dbName, key string) ([]*types.ValueWithMetadata, error)
- func (s *Store) GetMostRecentValueAtOrBelow(dbName, key string, version *types.Version) (*types.ValueWithMetadata, error)
- func (s *Store) GetNextValues(dbName, key string, version *types.Version, limit int) ([]*types.ValueWithMetadata, error)
- func (s *Store) GetPreviousValues(dbName, key string, version *types.Version, limit int) ([]*types.ValueWithMetadata, error)
- func (s *Store) GetReaders(dbName, key string) (map[string]uint32, error)
- func (s *Store) GetTxIDLocation(txID string) (*TxIDLocation, error)
- func (s *Store) GetTxIDsSubmittedByUser(userID string) ([]string, error)
- func (s *Store) GetValueAt(dbName, key string, version *types.Version) (*types.ValueWithMetadata, error)
- func (s *Store) GetValues(dbName, key string) ([]*types.ValueWithMetadata, error)
- func (s *Store) GetValuesDeletedByUser(userID string) (map[string]*types.KVsWithMetadata, error)
- func (s *Store) GetValuesReadByUser(userID string) (map[string]*types.KVsWithMetadata, error)
- func (s *Store) GetValuesWrittenByUser(userID string) (map[string]*types.KVsWithMetadata, error)
- func (s *Store) GetWriters(dbName, key string) (map[string]uint32, error)
- type TxDataForProvenance
- type TxIDLocation
Constants ¶
const ( // SUBMITTED edge from userID to txID // denotes that the txID was submitted by the userID SUBMITTED = "s" // INCLUDES edge from blockNum to txID // denotes that the block includes the txID INCLUDES = "i" // WRITES edge from txID to value // denotes that the txID written the value WRITES = "w" // READS edge from txID to value // denotes that the txID read the value READS = "r" // DELETES edge from txID to the value // denotes that the txID deleted the value // including the key DELETES = "d" // NEXT edge from one value to another // denotes that the next version of the value NEXT = "n" // PREVIOUS edge from one to another // denotes that the previous version of the value PREVIOUS = "p" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { StoreDir string Disabled bool Logger *logger.SugarLogger }
Config holds the configuration parameter of the provenance store
type KeyWithVersion ¶
KeyWithVersion holds a key and a version
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds information about the provenance store, i.e., a graph database
func Open ¶
Open opens a provenance store to maintain historical values of each state.
If the provenance store is Config.Disabled is set, the disabled-flag file is created and nil is returned. If the disabled-flag file exists, the store cannot be re-enabled, and passing Config.Disabled=false results in an error.
func (*Store) Commit ¶
func (s *Store) Commit(blockNum uint64, txsData []*TxDataForProvenance) error
Commit commits the txsData to a graph database. The following relationships are stored
- userID--(submitted)-->txID
- blockNum--(includes)->txID
- txID--(reads)-->value
- txID--(write)-->value
- txID--(delete)-->value
- key--(version)-->value
- value<--(previous)--value
- value--(next)-->value
func (*Store) GetDeletedValues ¶
func (s *Store) GetDeletedValues(dbName, key string) ([]*types.ValueWithMetadata, error)
GetDeletedValues returns all deleted values associated with a given key present in the given database name
func (*Store) GetMostRecentValueAtOrBelow ¶
func (s *Store) GetMostRecentValueAtOrBelow(dbName, key string, version *types.Version) (*types.ValueWithMetadata, error)
GetMostRecentValueAtOrBelow returns the most recent value hold by the given key at or below a given version
func (*Store) GetNextValues ¶
func (s *Store) GetNextValues(dbName, key string, version *types.Version, limit int) ([]*types.ValueWithMetadata, error)
GetNextValues returns next values of a given key and a version. The number of records returned would be limited by the limit parameters.
func (*Store) GetPreviousValues ¶
func (s *Store) GetPreviousValues(dbName, key string, version *types.Version, limit int) ([]*types.ValueWithMetadata, error)
GetPreviousValues returns previous values of a given key and a version. The number of records returned would be limited by the limit parameters.
func (*Store) GetReaders ¶
GetReaders returns all userIDs who have accessed a given key as well as the access frequency
func (*Store) GetTxIDLocation ¶
func (s *Store) GetTxIDLocation(txID string) (*TxIDLocation, error)
GetTxIDLocation returns the location, i.e, block number and the tx index, of a given txID
func (*Store) GetTxIDsSubmittedByUser ¶
GetTxIDsSubmittedByUser returns all ids of all transactions submitted by a given user
func (*Store) GetValueAt ¶
func (s *Store) GetValueAt(dbName, key string, version *types.Version) (*types.ValueWithMetadata, error)
GetValueAt returns the value of a given key at a particular version
func (*Store) GetValues ¶
func (s *Store) GetValues(dbName, key string) ([]*types.ValueWithMetadata, error)
GetValues returns all values associated with a given key
func (*Store) GetValuesDeletedByUser ¶
GetValuesDeletedByUser returns all values deleted by a given user
func (*Store) GetValuesReadByUser ¶
GetValuesReadByUser returns all values read by a given user
func (*Store) GetValuesWrittenByUser ¶
GetValuesWrittenByUser returns all values written by a given user
type TxDataForProvenance ¶
type TxDataForProvenance struct { IsValid bool DBName string UserID string TxID string Reads []*KeyWithVersion Writes []*types.KVWithMetadata Deletes map[string]*types.Version OldVersionOfWrites map[string]*types.Version }
TxDataForProvenance holds the transaction data that is needed for the provenance store
type TxIDLocation ¶
TxIDLocation refers to the location of a TxID in the block