pvtstatepurgemgmt

package
v2.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collections

type Collections struct {
	Map                  map[string]*KeysAndHashes `` /* 147-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                  `json:"-"`
	XXX_unrecognized     []byte                    `json:"-"`
	XXX_sizecache        int32                     `json:"-"`
}

func (*Collections) Descriptor

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

func (*Collections) GetMap

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

func (*Collections) ProtoMessage

func (*Collections) ProtoMessage()

func (*Collections) Reset

func (m *Collections) Reset()

func (*Collections) String

func (m *Collections) String() string

func (*Collections) XXX_DiscardUnknown

func (m *Collections) XXX_DiscardUnknown()

func (*Collections) XXX_Marshal

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

func (*Collections) XXX_Merge

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

func (*Collections) XXX_Size

func (m *Collections) XXX_Size() int

func (*Collections) XXX_Unmarshal

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

type KeyAndHash

type KeyAndHash struct {
	Key                  string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Hash                 []byte   `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*KeyAndHash) Descriptor

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

func (*KeyAndHash) GetHash

func (m *KeyAndHash) GetHash() []byte

func (*KeyAndHash) GetKey

func (m *KeyAndHash) GetKey() string

func (*KeyAndHash) ProtoMessage

func (*KeyAndHash) ProtoMessage()

func (*KeyAndHash) Reset

func (m *KeyAndHash) Reset()

func (*KeyAndHash) String

func (m *KeyAndHash) String() string

func (*KeyAndHash) XXX_DiscardUnknown

func (m *KeyAndHash) XXX_DiscardUnknown()

func (*KeyAndHash) XXX_Marshal

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

func (*KeyAndHash) XXX_Merge

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

func (*KeyAndHash) XXX_Size

func (m *KeyAndHash) XXX_Size() int

func (*KeyAndHash) XXX_Unmarshal

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

type KeysAndHashes

type KeysAndHashes struct {
	List                 []*KeyAndHash `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (*KeysAndHashes) Descriptor

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

func (*KeysAndHashes) GetList

func (m *KeysAndHashes) GetList() []*KeyAndHash

func (*KeysAndHashes) ProtoMessage

func (*KeysAndHashes) ProtoMessage()

func (*KeysAndHashes) Reset

func (m *KeysAndHashes) Reset()

func (*KeysAndHashes) String

func (m *KeysAndHashes) String() string

func (*KeysAndHashes) XXX_DiscardUnknown

func (m *KeysAndHashes) XXX_DiscardUnknown()

func (*KeysAndHashes) XXX_Marshal

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

func (*KeysAndHashes) XXX_Merge

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

func (*KeysAndHashes) XXX_Size

func (m *KeysAndHashes) XXX_Size() int

func (*KeysAndHashes) XXX_Unmarshal

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

type PurgeMgr

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

PurgeMgr keeps track of the expiry of private data and the private data hashes based on block-to-live parameter specified in the corresponding collection config

func InstantiatePurgeMgr

func InstantiatePurgeMgr(ledgerid string, db *privacyenabledstate.DB, btlPolicy pvtdatapolicy.BTLPolicy, bookkeepingProvider *bookkeeping.Provider) (*PurgeMgr, error)

InstantiatePurgeMgr instantiates a PurgeMgr.

func (*PurgeMgr) AddExpiredEntriesToUpdateBatch

func (p *PurgeMgr) AddExpiredEntriesToUpdateBatch(
	pvtUpdates *privacyenabledstate.PvtUpdateBatch,
	hashedUpdates *privacyenabledstate.HashedUpdateBatch) error

AddExpiredEntriesToUpdateBatch add the expired pvtdata to the updateBatch of next block to be committed

func (*PurgeMgr) BlockCommitDone

func (p *PurgeMgr) BlockCommitDone() error

BlockCommitDone is a callback to the PurgeMgr when the block is committed to the ledger These orphan entries for purge-schedule can be cleared off in bulk in a separate background routine as well If we maintain the following logic (i.e., clear off entries just after block commit), we need a TODO - We need to perform a check in the start, because there could be a crash between the block commit and invocation to this function resulting in the orphan entry for the deletes scheduled for the last block Also, the another way is to club the delete of these entries in the same batch that adds entries for the future expirations - however, that requires updating the expiry store by replaying the last block from blockchain in order to sustain a crash between entries updates and block commit

func (*PurgeMgr) PrepareForExpiringKeys

func (p *PurgeMgr) PrepareForExpiringKeys(expiringAtBlk uint64)

PrepareForExpiringKeys gives a chance to the PurgeMgr to do background work in advance if any

func (*PurgeMgr) UpdateExpiryInfo

func (p *PurgeMgr) UpdateExpiryInfo(
	pvtUpdates *privacyenabledstate.PvtUpdateBatch,
	hashedUpdates *privacyenabledstate.HashedUpdateBatch) error

UpdateExpiryInfo persists the expiry information for the private data and private data hashes This function is expected to be invoked before the updates are applied to the statedb for the block commit

func (*PurgeMgr) UpdateExpiryInfoOfPvtDataOfOldBlocks

func (p *PurgeMgr) UpdateExpiryInfoOfPvtDataOfOldBlocks(pvtUpdates *privacyenabledstate.PvtUpdateBatch) error

UpdateExpiryInfoOfPvtDataOfOldBlocks updates the existing expiry entries in the expiryKeeper with the given pvtUpdates

func (*PurgeMgr) WaitForPrepareToFinish

func (p *PurgeMgr) WaitForPrepareToFinish()

WaitForPrepareToFinish holds the caller till the background goroutine launched by 'PrepareForExpiringKeys' is finished

type PurgeMgrBuilder

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

func NewPurgeMgrBuilder

func NewPurgeMgrBuilder(
	ledgerID string,
	btlPolicy pvtdatapolicy.BTLPolicy,
	bookkeepingProvider *bookkeeping.Provider,
) *PurgeMgrBuilder

NewPurgeMgrBuilder returns PurgeMgrBuilder that builds the entries for the purgr manager for a given ledger

func (*PurgeMgrBuilder) ConsumeSnapshotData

func (b *PurgeMgrBuilder) ConsumeSnapshotData(
	namespace, coll string,
	keyHash, valueHash []byte,
	version *version.Height,
) error

ConsumeSnapshotData implements the function in the interface privacuenabledstate.SnapshotPvtdataHashesConsumer. This is intended to be invoked for populating the expiry data in the purge manager for the keyhashses

func (*PurgeMgrBuilder) Done

func (b *PurgeMgrBuilder) Done() error

type PvtdataKeys

type PvtdataKeys struct {
	Map                  map[string]*Collections `` /* 147-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                `json:"-"`
	XXX_unrecognized     []byte                  `json:"-"`
	XXX_sizecache        int32                   `json:"-"`
}

func (*PvtdataKeys) Descriptor

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

func (*PvtdataKeys) GetMap

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

func (*PvtdataKeys) ProtoMessage

func (*PvtdataKeys) ProtoMessage()

func (*PvtdataKeys) Reset

func (m *PvtdataKeys) Reset()

func (*PvtdataKeys) String

func (m *PvtdataKeys) String() string

func (*PvtdataKeys) XXX_DiscardUnknown

func (m *PvtdataKeys) XXX_DiscardUnknown()

func (*PvtdataKeys) XXX_Marshal

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

func (*PvtdataKeys) XXX_Merge

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

func (*PvtdataKeys) XXX_Size

func (m *PvtdataKeys) XXX_Size() int

func (*PvtdataKeys) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL