fabric: github.com/hyperledger/fabric/core/ledger/pvtdatastorage Index | Files

package pvtdatastorage

import "github.com/hyperledger/fabric/core/ledger/pvtdatastorage"

Index

Package Files

helper.go kv_encoding.go persistent_msgs.pb.go persistent_msgs_helper.go store.go store_impl.go test_exports.go v11.go

type CollElgInfo Uses

type CollElgInfo struct {
    NsCollMap            map[string]*CollNames `protobuf:"bytes,1,rep,name=nsCollMap,proto3" json:"nsCollMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    XXX_NoUnkeyedLiteral struct{}              `json:"-"`
    XXX_unrecognized     []byte                `json:"-"`
    XXX_sizecache        int32                 `json:"-"`
}

func (*CollElgInfo) Descriptor Uses

func (*CollElgInfo) Descriptor() ([]byte, []int)

func (*CollElgInfo) GetNsCollMap Uses

func (m *CollElgInfo) GetNsCollMap() map[string]*CollNames

func (*CollElgInfo) ProtoMessage Uses

func (*CollElgInfo) ProtoMessage()

func (*CollElgInfo) Reset Uses

func (m *CollElgInfo) Reset()

func (*CollElgInfo) String Uses

func (m *CollElgInfo) String() string

func (*CollElgInfo) XXX_DiscardUnknown Uses

func (m *CollElgInfo) XXX_DiscardUnknown()

func (*CollElgInfo) XXX_Marshal Uses

func (m *CollElgInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CollElgInfo) XXX_Merge Uses

func (m *CollElgInfo) XXX_Merge(src proto.Message)

func (*CollElgInfo) XXX_Size Uses

func (m *CollElgInfo) XXX_Size() int

func (*CollElgInfo) XXX_Unmarshal Uses

func (m *CollElgInfo) XXX_Unmarshal(b []byte) error

type CollNames Uses

type CollNames struct {
    Entries              []string `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

func (*CollNames) Descriptor Uses

func (*CollNames) Descriptor() ([]byte, []int)

func (*CollNames) GetEntries Uses

func (m *CollNames) GetEntries() []string

func (*CollNames) ProtoMessage Uses

func (*CollNames) ProtoMessage()

func (*CollNames) Reset Uses

func (m *CollNames) Reset()

func (*CollNames) String Uses

func (m *CollNames) String() string

func (*CollNames) XXX_DiscardUnknown Uses

func (m *CollNames) XXX_DiscardUnknown()

func (*CollNames) XXX_Marshal Uses

func (m *CollNames) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CollNames) XXX_Merge Uses

func (m *CollNames) XXX_Merge(src proto.Message)

func (*CollNames) XXX_Size Uses

func (m *CollNames) XXX_Size() int

func (*CollNames) XXX_Unmarshal Uses

func (m *CollNames) XXX_Unmarshal(b []byte) error

type Collections Uses

type Collections struct {
    // for pvt data, there would be an
    // entry in TxNums
    Map map[string]*TxNums `protobuf:"bytes,1,rep,name=map,proto3" json:"map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    // for any number of missing pvt data of a collection,
    // there would be an entry in the map
    MissingDataMap       map[string]bool `protobuf:"bytes,2,rep,name=missingDataMap,proto3" json:"missingDataMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
    XXX_NoUnkeyedLiteral struct{}        `json:"-"`
    XXX_unrecognized     []byte          `json:"-"`
    XXX_sizecache        int32           `json:"-"`
}

func (*Collections) Descriptor Uses

func (*Collections) Descriptor() ([]byte, []int)

func (*Collections) GetMap Uses

func (m *Collections) GetMap() map[string]*TxNums

func (*Collections) GetMissingDataMap Uses

func (m *Collections) GetMissingDataMap() map[string]bool

func (*Collections) ProtoMessage Uses

func (*Collections) ProtoMessage()

func (*Collections) Reset Uses

func (m *Collections) Reset()

func (*Collections) String Uses

func (m *Collections) String() string

func (*Collections) XXX_DiscardUnknown Uses

func (m *Collections) XXX_DiscardUnknown()

func (*Collections) XXX_Marshal Uses

func (m *Collections) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Collections) XXX_Merge Uses

func (m *Collections) XXX_Merge(src proto.Message)

func (*Collections) XXX_Size Uses

func (m *Collections) XXX_Size() int

func (*Collections) XXX_Unmarshal Uses

func (m *Collections) XXX_Unmarshal(b []byte) error

type ErrIllegalArgs Uses

type ErrIllegalArgs struct {
    // contains filtered or unexported fields
}

ErrIllegalArgs is to be thrown by a store impl if the args passed are not allowed

func (*ErrIllegalArgs) Error Uses

func (err *ErrIllegalArgs) Error() string

type ErrIllegalCall Uses

type ErrIllegalCall struct {
    // contains filtered or unexported fields
}

ErrIllegalCall is to be thrown by a store impl if the store does not expect a call to Prepare/Commit/Rollback/InitLastCommittedBlock

func (*ErrIllegalCall) Error Uses

func (err *ErrIllegalCall) Error() string

type ErrOutOfRange Uses

type ErrOutOfRange struct {
    // contains filtered or unexported fields
}

ErrOutOfRange is to be thrown for the request for the data that is not yet committed

func (*ErrOutOfRange) Error Uses

func (err *ErrOutOfRange) Error() string

type ExpiryData Uses

type ExpiryData struct {
    Map                  map[string]*Collections `protobuf:"bytes,1,rep,name=map,proto3" json:"map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    XXX_NoUnkeyedLiteral struct{}                `json:"-"`
    XXX_unrecognized     []byte                  `json:"-"`
    XXX_sizecache        int32                   `json:"-"`
}

func (*ExpiryData) Descriptor Uses

func (*ExpiryData) Descriptor() ([]byte, []int)

func (*ExpiryData) GetMap Uses

func (m *ExpiryData) GetMap() map[string]*Collections

func (*ExpiryData) ProtoMessage Uses

func (*ExpiryData) ProtoMessage()

func (*ExpiryData) Reset Uses

func (m *ExpiryData) Reset()

func (*ExpiryData) String Uses

func (m *ExpiryData) String() string

func (*ExpiryData) XXX_DiscardUnknown Uses

func (m *ExpiryData) XXX_DiscardUnknown()

func (*ExpiryData) XXX_Marshal Uses

func (m *ExpiryData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExpiryData) XXX_Merge Uses

func (m *ExpiryData) XXX_Merge(src proto.Message)

func (*ExpiryData) XXX_Size Uses

func (m *ExpiryData) XXX_Size() int

func (*ExpiryData) XXX_Unmarshal Uses

func (m *ExpiryData) XXX_Unmarshal(b []byte) error

type PrivateDataConfig Uses

type PrivateDataConfig struct {
    // PrivateDataConfig is used to configure a private data storage provider
    *ledger.PrivateDataConfig
    // StorePath is the filesystem path for private data storage.
    // It is internally computed by the ledger component,
    // so it is not in ledger.PrivateDataConfig and not exposed to other components.
    StorePath string
}

PrivateDataConfig encapsulates the configuration for private data storage on the ledger

type Provider Uses

type Provider interface {
    OpenStore(id string) (Store, error)
    Close()
}

Provider provides handle to specific 'Store' that in turn manages private write sets for a ledger

func NewProvider Uses

func NewProvider(conf *PrivateDataConfig) (Provider, error)

NewProvider instantiates a StoreProvider

type Store Uses

type Store interface {
    // Init initializes the store. This function is expected to be invoked before using the store
    Init(btlPolicy pvtdatapolicy.BTLPolicy)
    // GetPvtDataByBlockNum returns only the pvt data  corresponding to the given block number
    // The pvt data is filtered by the list of 'ns/collections' supplied in the filter
    // A nil filter does not filter any results
    GetPvtDataByBlockNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, error)
    // GetMissingPvtDataInfoForMostRecentBlocks returns the missing private data information for the
    // most recent `maxBlock` blocks which miss at least a private data of a eligible collection.
    GetMissingPvtDataInfoForMostRecentBlocks(maxBlock int) (ledger.MissingPvtDataInfo, error)
    // Commit commits the pvt data as well as both the eligible and ineligible
    // missing private data --- `eligible` denotes that the missing private data belongs to a collection
    // for which this peer is a member; `ineligible` denotes that the missing private data belong to a
    // collection for which this peer is not a member.
    Commit(blockNum uint64, pvtData []*ledger.TxPvtData, missingPvtData ledger.TxMissingPvtDataMap) error
    // ProcessCollsEligibilityEnabled notifies the store when the peer becomes eligible to receive data for an
    // existing collection. Parameter 'committingBlk' refers to the block number that contains the corresponding
    // collection upgrade transaction and the parameter 'nsCollMap' contains the collections for which the peer
    // is now eligible to receive pvt data
    ProcessCollsEligibilityEnabled(committingBlk uint64, nsCollMap map[string][]string) error
    // CommitPvtDataOfOldBlocks commits the pvtData (i.e., previously missing data) of old blocks.
    // The parameter `blocksPvtData` refers a list of old block's pvtdata which are missing in the pvtstore.
    // This call stores an additional entry called `lastUpdatedOldBlocksList` which keeps the exact list
    // of updated blocks. This list would be used during recovery process. Once the stateDB is updated with
    // these pvtData, the `lastUpdatedOldBlocksList` must be removed. During the peer startup,
    // if the `lastUpdatedOldBlocksList` exists, stateDB needs to be updated with the appropriate pvtData.
    CommitPvtDataOfOldBlocks(blocksPvtData map[uint64][]*ledger.TxPvtData) error
    // GetLastUpdatedOldBlocksPvtData returns the pvtdata of blocks listed in `lastUpdatedOldBlocksList`
    GetLastUpdatedOldBlocksPvtData() (map[uint64][]*ledger.TxPvtData, error)
    // ResetLastUpdatedOldBlocksList removes the `lastUpdatedOldBlocksList` entry from the store
    ResetLastUpdatedOldBlocksList() error
    // LastCommittedBlockHeight returns the height of the last committed block
    LastCommittedBlockHeight() (uint64, error)
    // Shutdown stops the store
    Shutdown()
}

Store manages the permanent storage of private write sets for a ledger Because the pvt data is supposed to be in sync with the blocks in the ledger, both should logically happen in an atomic operation. In order to accomplish this, an implementation of this store should provide support for a two-phase like commit/rollback capability. The expected use is such that - first the private data will be given to this store (via `Prepare` function) and then the block is appended to the block storage. Finally, one of the functions `Commit` or `Rollback` is invoked on this store based on whether the block was written successfully or not. The store implementation is expected to survive a server crash between the call to `Prepare` and `Commit`/`Rollback`

type StoreEnv Uses

type StoreEnv struct {
    TestStoreProvider Provider
    TestStore         Store
    // contains filtered or unexported fields
}

StoreEnv provides the store env for testing

func NewTestStoreEnv Uses

func NewTestStoreEnv(
    t *testing.T,
    ledgerid string,
    btlPolicy pvtdatapolicy.BTLPolicy,
    conf *PrivateDataConfig) *StoreEnv

NewTestStoreEnv construct a StoreEnv for testing

func (*StoreEnv) Cleanup Uses

func (env *StoreEnv) Cleanup()

Cleanup cleansup the store env after testing

func (*StoreEnv) CloseAndReopen Uses

func (env *StoreEnv) CloseAndReopen()

CloseAndReopen closes and opens the store provider

type TxNums Uses

type TxNums struct {
    List                 []uint64 `protobuf:"varint,1,rep,packed,name=list,proto3" json:"list,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

func (*TxNums) Descriptor Uses

func (*TxNums) Descriptor() ([]byte, []int)

func (*TxNums) GetList Uses

func (m *TxNums) GetList() []uint64

func (*TxNums) ProtoMessage Uses

func (*TxNums) ProtoMessage()

func (*TxNums) Reset Uses

func (m *TxNums) Reset()

func (*TxNums) String Uses

func (m *TxNums) String() string

func (*TxNums) XXX_DiscardUnknown Uses

func (m *TxNums) XXX_DiscardUnknown()

func (*TxNums) XXX_Marshal Uses

func (m *TxNums) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TxNums) XXX_Merge Uses

func (m *TxNums) XXX_Merge(src proto.Message)

func (*TxNums) XXX_Size Uses

func (m *TxNums) XXX_Size() int

func (*TxNums) XXX_Unmarshal Uses

func (m *TxNums) XXX_Unmarshal(b []byte) error

Package pvtdatastorage imports 20 packages (graph) and is imported by 12 packages. Updated 2020-03-30. Refresh now. Tools for package owners.