diff --git a/cmd/mircat/debug.go b/cmd/mircat/debug.go index a30f5615d..16a5cddc0 100644 --- a/cmd/mircat/debug.go +++ b/cmd/mircat/debug.go @@ -170,6 +170,7 @@ func debuggerNode(id t.NodeID, membership *trantorpbtypes.Membership) (*mir.Node Self: "iss", App: "batchfetcher", Availability: "availability", + BatchDB: "batchdb", Checkpoint: "checkpointing", Net: "net", Ordering: "ordering", diff --git a/pkg/availability/batchdb/fakebatchdb/fakebatchdb.go b/pkg/availability/batchdb/fakebatchdb/fakebatchdb.go index a01b589c2..edc9fa60d 100644 --- a/pkg/availability/batchdb/fakebatchdb/fakebatchdb.go +++ b/pkg/availability/batchdb/fakebatchdb/fakebatchdb.go @@ -17,13 +17,13 @@ type ModuleConfig struct { } type moduleState struct { - BatchStore map[msctypes.BatchID]batchInfo - TransactionStore map[tt.TxID]*trantorpbtypes.Transaction + batchStore map[msctypes.BatchID]*batch + batchesByRetIdx map[tt.RetentionIndex][]msctypes.BatchID + retIdx tt.RetentionIndex } -type batchInfo struct { - txIDs []tt.TxID - metadata []byte +type batch struct { + txs []*trantorpbtypes.Transaction } // NewModule returns a new module for a fake batch database. @@ -32,21 +32,32 @@ func NewModule(mc ModuleConfig) modules.Module { m := dsl.NewModule(mc.Self) state := moduleState{ - BatchStore: make(map[msctypes.BatchID]batchInfo), - TransactionStore: make(map[tt.TxID]*trantorpbtypes.Transaction), + batchStore: make(map[msctypes.BatchID]*batch), + batchesByRetIdx: make(map[tt.RetentionIndex][]msctypes.BatchID), + retIdx: 0, } // On StoreBatch request, just store the data in the local memory. - batchdbpbdsl.UponStoreBatch(m, func(batchID msctypes.BatchID, txIDs []tt.TxID, txs []*trantorpbtypes.Transaction, metadata []byte, origin *batchdbpbtypes.StoreBatchOrigin) error { - state.BatchStore[batchID] = batchInfo{ - txIDs: txIDs, - metadata: metadata, - } + batchdbpbdsl.UponStoreBatch(m, func( + batchID msctypes.BatchID, + txs []*trantorpbtypes.Transaction, + retIdx tt.RetentionIndex, + origin *batchdbpbtypes.StoreBatchOrigin, + ) error { - for i, txID := range txIDs { - state.TransactionStore[txID] = txs[i] + // Only save the batch if its retention index has not yet been garbage-collected. + if retIdx >= state.retIdx { + b := batch{txs} + state.batchStore[batchID] = &b + state.batchesByRetIdx[retIdx] = append(state.batchesByRetIdx[retIdx], batchID) } + // Note that we emit a BatchStored event even if the batch's retention index was too low + // (and thus the batch was not actually stored). + // However, since this situation is indistinguishable from + // storing the batch and immediately garbage-collecting it, + // it is simpler to report success to the module that produced the StoreBatch event + // (rather than creating a whole different code branch with no real utility). batchdbpbdsl.BatchStored(m, origin.Module, origin) return nil }) @@ -54,18 +65,23 @@ func NewModule(mc ModuleConfig) modules.Module { // On LookupBatch request, just check the local map. batchdbpbdsl.UponLookupBatch(m, func(batchID msctypes.BatchID, origin *batchdbpbtypes.LookupBatchOrigin) error { - info, found := state.BatchStore[batchID] + storedBatch, found := state.batchStore[batchID] if !found { batchdbpbdsl.LookupBatchResponse(m, origin.Module, false, nil, origin) return nil } - txs := make([]*trantorpbtypes.Transaction, len(info.txIDs)) - for i, txID := range info.txIDs { - txs[i] = state.TransactionStore[txID] - } + batchdbpbdsl.LookupBatchResponse(m, origin.Module, true, storedBatch.txs, origin) + return nil + }) - batchdbpbdsl.LookupBatchResponse(m, origin.Module, true, txs, origin) + batchdbpbdsl.UponGarbageCollect(m, func(retentionIndex tt.RetentionIndex) error { + for ; state.retIdx < retentionIndex; state.retIdx++ { + for _, batchID := range state.batchesByRetIdx[state.retIdx] { + delete(state.batchStore, batchID) + } + delete(state.batchesByRetIdx, state.retIdx) + } return nil }) diff --git a/pkg/availability/multisigcollector/common/common.go b/pkg/availability/multisigcollector/common/common.go index 691eb3b3e..b93acd706 100644 --- a/pkg/availability/multisigcollector/common/common.go +++ b/pkg/availability/multisigcollector/common/common.go @@ -30,11 +30,25 @@ type ModuleConfig struct { // ModuleParams sets the values for the parameters of an instance of the protocol. // All replicas are expected to use identical module parameters. type ModuleParams struct { - InstanceUID []byte // unique identifier for this instance used to prevent replay attacks - EpochNr tt.EpochNr // The epoch in which this instance of MultisigCollector operates - Membership *trantorpbtypes.Membership // the list of participating nodes - Limit int // the maximum number of certificates to generate before a request is completed - MaxRequests int // the maximum number of requests to be provided by this module + + // InstanceUID is a unique identifier for this instance used to prevent replay attacks. + InstanceUID []byte + + // Membership defines the set of nodes participating in a particular instance of the multisig collector. + Membership *trantorpbtypes.Membership + + // Limit is the maximum number of certificates to generate before a request is completed. + Limit int + + // MaxRequests is the maximum number of certificate requests to be handled by this module. + // It prevents the multisig collector from continuing operation (transaction dissemination) + // after no more certificate requests are going to arrive. + MaxRequests int + + // EpochNr is the epoch in which the instance of MultisigCollector operates. + // It is used as the RetentionIndex to associate with all newly stored batches. + // and batches requested from the mempool. + EpochNr tt.EpochNr } // SigData is the binary data that should be signed for forming a certificate. diff --git a/pkg/availability/multisigcollector/internal/parts/batchreconstruction/batchreconstruction.go b/pkg/availability/multisigcollector/internal/parts/batchreconstruction/batchreconstruction.go index 23da44992..8293e2a9f 100644 --- a/pkg/availability/multisigcollector/internal/parts/batchreconstruction/batchreconstruction.go +++ b/pkg/availability/multisigcollector/internal/parts/batchreconstruction/batchreconstruction.go @@ -168,7 +168,13 @@ func IncludeBatchReconstruction( return nil } - batchdbpbdsl.StoreBatch(m, mc.BatchDB, batchID, context.txIDs, context.txs, []byte{} /*metadata*/, &storeBatchContext{}) + batchdbpbdsl.StoreBatch(m, + mc.BatchDB, + batchID, + context.txs, + tt.RetentionIndex(params.EpochNr), + &storeBatchContext{}, + ) saveAndFinish(m, context.reqID, context.txs, context.batchID, requestState.ReqOrigin, &state) return nil diff --git a/pkg/availability/multisigcollector/internal/parts/certcreation/certcreation.go b/pkg/availability/multisigcollector/internal/parts/certcreation/certcreation.go index 852e95f5b..72dae735f 100644 --- a/pkg/availability/multisigcollector/internal/parts/certcreation/certcreation.go +++ b/pkg/availability/multisigcollector/internal/parts/certcreation/certcreation.go @@ -84,7 +84,7 @@ func IncludeCreatingCertificates( reqOrigin: origin, }) - respondIfReady(m, &state, params) + respondIfReady(m, &state, params.Membership) if len(state.certificates) == 0 { apbdsl.ComputeCert(m, mc.Self) } @@ -164,7 +164,7 @@ func IncludeCreatingCertificates( newDue := membutil.HaveWeakQuorum(params.Membership, maputil.GetKeys(cert.sigs)) // keep this here... if len(state.requestStates) > 0 { - respondIfReady(m, &state, params) // ... because this call changes the state + respondIfReady(m, &state, params.Membership) // ... because this call changes the state } if newDue && len(state.certificates) < params.Limit { @@ -204,7 +204,7 @@ func IncludeCreatingCertificates( // When the id of the batch is computed, store the batch persistently. mempooldsl.UponBatchIDResponse(m, func(batchID msctypes.BatchID, context *computeIDOfReceivedBatchContext) error { - batchdbpbdsl.StoreBatch(m, mc.BatchDB, batchID, context.txIDs, context.txs, nil, /*metadata*/ + batchdbpbdsl.StoreBatch(m, mc.BatchDB, batchID, context.txs, tt.RetentionIndex(params.EpochNr), &storeBatchContext{context.sourceID, context.reqID, batchID}) // TODO minor optimization: start computing cert without waiting for reply (maybe do not even get a reply from batchdb) return nil @@ -224,11 +224,11 @@ func IncludeCreatingCertificates( }) } -func respondIfReady(m dsl.Module, state *certCreationState, params *common.ModuleParams) { +func respondIfReady(m dsl.Module, state *certCreationState, membership *trantorpbtypes.Membership) { // Select certificates with enough signatures. finishedCerts := maputil.RemoveAll(state.certificates, func(_ requestID, cert *certificate) bool { - return membutil.HaveWeakQuorum(params.Membership, maputil.GetKeys(cert.sigs)) + return membutil.HaveWeakQuorum(membership, maputil.GetKeys(cert.sigs)) }) // Return immediately if there are no finished certificates. diff --git a/pkg/iss/iss.go b/pkg/iss/iss.go index 89bb454cc..18d9d09b9 100644 --- a/pkg/iss/iss.go +++ b/pkg/iss/iss.go @@ -15,8 +15,6 @@ import ( "encoding/binary" "fmt" - ppv "github.com/filecoin-project/mir/pkg/orderers/common/pprepvalidator" - es "github.com/go-errors/errors" "google.golang.org/protobuf/proto" @@ -30,8 +28,10 @@ import ( "github.com/filecoin-project/mir/pkg/modules" "github.com/filecoin-project/mir/pkg/orderers" "github.com/filecoin-project/mir/pkg/orderers/common" + ppv "github.com/filecoin-project/mir/pkg/orderers/common/pprepvalidator" apppbdsl "github.com/filecoin-project/mir/pkg/pb/apppb/dsl" "github.com/filecoin-project/mir/pkg/pb/availabilitypb" + batchdbpbdsl "github.com/filecoin-project/mir/pkg/pb/availabilitypb/batchdbpb/dsl" apbdsl "github.com/filecoin-project/mir/pkg/pb/availabilitypb/dsl" mscpbtypes "github.com/filecoin-project/mir/pkg/pb/availabilitypb/mscpb/types" apbtypes "github.com/filecoin-project/mir/pkg/pb/availabilitypb/types" @@ -629,7 +629,8 @@ func (iss *ISS) initAvailability() { MultisigCollector: &mscpbtypes.InstanceParams{ Epoch: iss.epoch.Nr(), Membership: iss.memberships[0], - MaxRequests: uint64(iss.Params.SegmentLength)}, + MaxRequests: uint64(iss.Params.SegmentLength), + }, }, }, ) @@ -914,12 +915,13 @@ func (iss *ISS) deliverCommonCheckpoint(chkpData []byte) error { pruneIndex := int(chkp.Epoch()) - iss.Params.RetainedEpochs if pruneIndex > 0 { // "> 0" and not ">= 0", since only entries strictly smaller than the index are pruned. - // Prune timer, checkpointing, availability, and orderers. + // Prune timer, checkpointing, availability, orderers, and other modules. eventpbdsl.TimerGarbageCollect(iss.m, iss.moduleConfig.Timer, tt.RetentionIndex(pruneIndex)) factorypbdsl.GarbageCollect(iss.m, iss.moduleConfig.Checkpoint, tt.RetentionIndex(pruneIndex)) factorypbdsl.GarbageCollect(iss.m, iss.moduleConfig.Availability, tt.RetentionIndex(pruneIndex)) factorypbdsl.GarbageCollect(iss.m, iss.moduleConfig.Ordering, tt.RetentionIndex(pruneIndex)) factorypbdsl.GarbageCollect(iss.m, iss.moduleConfig.PPrepValidatorChkp, tt.RetentionIndex(pruneIndex)) + batchdbpbdsl.GarbageCollect(iss.m, iss.moduleConfig.BatchDB, tt.RetentionIndex(pruneIndex)) // Prune epoch state. for epoch := range iss.epochs { diff --git a/pkg/iss/moduleconfig.go b/pkg/iss/moduleconfig.go index ed47fe5fd..7887b459d 100644 --- a/pkg/iss/moduleconfig.go +++ b/pkg/iss/moduleconfig.go @@ -8,6 +8,7 @@ type ModuleConfig struct { Self t.ModuleID App t.ModuleID Availability t.ModuleID + BatchDB t.ModuleID Checkpoint t.ModuleID ChkpValidator t.ModuleID Net t.ModuleID diff --git a/pkg/pb/availabilitypb/batchdbpb/batchdbpb.pb.go b/pkg/pb/availabilitypb/batchdbpb/batchdbpb.pb.go index dd5631844..1aeb34ad7 100644 --- a/pkg/pb/availabilitypb/batchdbpb/batchdbpb.pb.go +++ b/pkg/pb/availabilitypb/batchdbpb/batchdbpb.pb.go @@ -34,6 +34,7 @@ type Event struct { // *Event_LookupResponse // *Event_Store // *Event_Stored + // *Event_GarbageCollect Type isEvent_Type `protobuf_oneof:"Type"` } @@ -104,6 +105,13 @@ func (x *Event) GetStored() *BatchStored { return nil } +func (x *Event) GetGarbageCollect() *GarbageCollect { + if x, ok := x.GetType().(*Event_GarbageCollect); ok { + return x.GarbageCollect + } + return nil +} + type isEvent_Type interface { isEvent_Type() } @@ -124,6 +132,10 @@ type Event_Stored struct { Stored *BatchStored `protobuf:"bytes,4,opt,name=stored,proto3,oneof"` } +type Event_GarbageCollect struct { + GarbageCollect *GarbageCollect `protobuf:"bytes,5,opt,name=garbage_collect,json=garbageCollect,proto3,oneof"` +} + func (*Event_Lookup) isEvent_Type() {} func (*Event_LookupResponse) isEvent_Type() {} @@ -132,6 +144,8 @@ func (*Event_Store) isEvent_Type() {} func (*Event_Stored) isEvent_Type() {} +func (*Event_GarbageCollect) isEvent_Type() {} + // LookupBatch is used to pull a batch with its metadata from the local batch database. type LookupBatch struct { state protoimpl.MessageState @@ -258,11 +272,10 @@ type StoreBatch struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - BatchId []byte `protobuf:"bytes,1,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` - TxIds [][]byte `protobuf:"bytes,2,rep,name=tx_ids,json=txIds,proto3" json:"tx_ids,omitempty"` - Txs []*trantorpb.Transaction `protobuf:"bytes,3,rep,name=txs,proto3" json:"txs,omitempty"` - Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` // not used at the moment - Origin *StoreBatchOrigin `protobuf:"bytes,5,opt,name=origin,proto3" json:"origin,omitempty"` + BatchId []byte `protobuf:"bytes,1,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` + Txs []*trantorpb.Transaction `protobuf:"bytes,2,rep,name=txs,proto3" json:"txs,omitempty"` + RetentionIndex uint64 `protobuf:"varint,3,opt,name=retention_index,json=retentionIndex,proto3" json:"retention_index,omitempty"` + Origin *StoreBatchOrigin `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` } func (x *StoreBatch) Reset() { @@ -304,13 +317,6 @@ func (x *StoreBatch) GetBatchId() []byte { return nil } -func (x *StoreBatch) GetTxIds() [][]byte { - if x != nil { - return x.TxIds - } - return nil -} - func (x *StoreBatch) GetTxs() []*trantorpb.Transaction { if x != nil { return x.Txs @@ -318,11 +324,11 @@ func (x *StoreBatch) GetTxs() []*trantorpb.Transaction { return nil } -func (x *StoreBatch) GetMetadata() []byte { +func (x *StoreBatch) GetRetentionIndex() uint64 { if x != nil { - return x.Metadata + return x.RetentionIndex } - return nil + return 0 } func (x *StoreBatch) GetOrigin() *StoreBatchOrigin { @@ -380,6 +386,53 @@ func (x *BatchStored) GetOrigin() *StoreBatchOrigin { return nil } +type GarbageCollect struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RetentionIndex uint64 `protobuf:"varint,1,opt,name=retention_index,json=retentionIndex,proto3" json:"retention_index,omitempty"` +} + +func (x *GarbageCollect) Reset() { + *x = GarbageCollect{} + if protoimpl.UnsafeEnabled { + mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GarbageCollect) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GarbageCollect) ProtoMessage() {} + +func (x *GarbageCollect) ProtoReflect() protoreflect.Message { + mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GarbageCollect.ProtoReflect.Descriptor instead. +func (*GarbageCollect) Descriptor() ([]byte, []int) { + return file_availabilitypb_batchdbpb_batchdbpb_proto_rawDescGZIP(), []int{5} +} + +func (x *GarbageCollect) GetRetentionIndex() uint64 { + if x != nil { + return x.RetentionIndex + } + return 0 +} + type LookupBatchOrigin struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -395,7 +448,7 @@ type LookupBatchOrigin struct { func (x *LookupBatchOrigin) Reset() { *x = LookupBatchOrigin{} if protoimpl.UnsafeEnabled { - mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[5] + mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -408,7 +461,7 @@ func (x *LookupBatchOrigin) String() string { func (*LookupBatchOrigin) ProtoMessage() {} func (x *LookupBatchOrigin) ProtoReflect() protoreflect.Message { - mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[5] + mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -421,7 +474,7 @@ func (x *LookupBatchOrigin) ProtoReflect() protoreflect.Message { // Deprecated: Use LookupBatchOrigin.ProtoReflect.Descriptor instead. func (*LookupBatchOrigin) Descriptor() ([]byte, []int) { - return file_availabilitypb_batchdbpb_batchdbpb_proto_rawDescGZIP(), []int{5} + return file_availabilitypb_batchdbpb_batchdbpb_proto_rawDescGZIP(), []int{6} } func (x *LookupBatchOrigin) GetModule() string { @@ -483,7 +536,7 @@ type StoreBatchOrigin struct { func (x *StoreBatchOrigin) Reset() { *x = StoreBatchOrigin{} if protoimpl.UnsafeEnabled { - mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[6] + mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -496,7 +549,7 @@ func (x *StoreBatchOrigin) String() string { func (*StoreBatchOrigin) ProtoMessage() {} func (x *StoreBatchOrigin) ProtoReflect() protoreflect.Message { - mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[6] + mi := &file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -509,7 +562,7 @@ func (x *StoreBatchOrigin) ProtoReflect() protoreflect.Message { // Deprecated: Use StoreBatchOrigin.ProtoReflect.Descriptor instead. func (*StoreBatchOrigin) Descriptor() ([]byte, []int) { - return file_availabilitypb_batchdbpb_batchdbpb_proto_rawDescGZIP(), []int{6} + return file_availabilitypb_batchdbpb_batchdbpb_proto_rawDescGZIP(), []int{7} } func (x *StoreBatchOrigin) GetModule() string { @@ -569,7 +622,7 @@ var file_availabilitypb_batchdbpb_batchdbpb_proto_rawDesc = []byte{ 0x72, 0x61, 0x6e, 0x74, 0x6f, 0x72, 0x70, 0x62, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x74, 0x6f, 0x72, 0x70, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x6d, 0x69, 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf9, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x02, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x62, 0x61, 0x74, 0x63, 0x68, 0x64, 0x62, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x42, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x06, 0x6c, 0x6f, 0x6f, 0x6b, @@ -583,89 +636,102 @@ var file_availabilitypb_batchdbpb_batchdbpb_proto_rawDesc = []byte{ 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x62, 0x61, 0x74, 0x63, 0x68, 0x64, 0x62, 0x70, 0x62, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x64, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x3a, 0x04, - 0x90, 0xa6, 0x1d, 0x01, 0x42, 0x0c, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x04, 0x80, 0xa6, - 0x1d, 0x01, 0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x6f, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x42, 0x54, 0x82, 0xa6, 0x1d, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x63, 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x6d, 0x69, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x76, - 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x73, 0x69, 0x67, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x44, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, - 0x68, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, + 0x6f, 0x72, 0x65, 0x64, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x12, 0x44, + 0x0a, 0x0f, 0x67, 0x61, 0x72, 0x62, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x62, 0x61, 0x74, 0x63, 0x68, 0x64, + 0x62, 0x70, 0x62, 0x2e, 0x47, 0x61, 0x72, 0x62, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x67, 0x61, 0x72, 0x62, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x3a, 0x04, 0x90, 0xa6, 0x1d, 0x01, 0x42, 0x0c, 0x0a, 0x04, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x04, 0x80, 0xa6, 0x1d, 0x01, 0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x4c, 0x6f, 0x6f, + 0x6b, 0x75, 0x70, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x6f, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x54, 0x82, 0xa6, 0x1d, 0x50, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x63, + 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x6d, 0x69, 0x72, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, 0x67, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x44, + 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x64, 0x62, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x42, 0x61, 0x74, 0x63, + 0x68, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x52, 0x06, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x3a, 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x22, 0x97, 0x01, 0x0a, 0x13, + 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x05, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x28, 0x0a, 0x03, 0x74, 0x78, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x74, 0x6f, 0x72, + 0x70, 0x62, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, + 0x74, 0x78, 0x73, 0x12, 0x3a, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x61, 0x74, 0x63, 0x68, 0x64, 0x62, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4f, 0x72, 0x69, 0x67, 0x69, - 0x6e, 0x42, 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x3a, - 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x22, 0x97, 0x01, 0x0a, 0x13, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, - 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x66, 0x6f, - 0x75, 0x6e, 0x64, 0x12, 0x28, 0x0a, 0x03, 0x74, 0x78, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x74, 0x6f, 0x72, 0x70, 0x62, 0x2e, 0x54, 0x72, 0x61, - 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x74, 0x78, 0x73, 0x12, 0x3a, 0x0a, - 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, - 0x62, 0x61, 0x74, 0x63, 0x68, 0x64, 0x62, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, + 0x6e, 0x42, 0x04, 0xa0, 0xa6, 0x1d, 0x01, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x3a, + 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x22, 0xd7, 0x02, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x42, + 0x61, 0x74, 0x63, 0x68, 0x12, 0x6f, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x54, 0x82, 0xa6, 0x1d, 0x50, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x63, 0x6f, 0x69, 0x6e, 0x2d, + 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x6d, 0x69, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x73, 0x69, 0x67, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x44, 0x52, 0x07, 0x62, 0x61, + 0x74, 0x63, 0x68, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x03, 0x74, 0x78, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x74, 0x6f, 0x72, 0x70, 0x62, 0x2e, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x74, 0x78, 0x73, 0x12, + 0x6d, 0x0a, 0x0f, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x44, 0x82, 0xa6, 0x1d, 0x40, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x63, 0x6f, 0x69, + 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x6d, 0x69, 0x72, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x74, 0x6f, 0x72, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0e, + 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x39, + 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x62, 0x61, 0x74, 0x63, 0x68, 0x64, 0x62, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x42, 0x61, 0x74, 0x63, 0x68, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x04, 0x98, 0xa6, 0x1d, + 0x01, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x3a, 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x22, + 0x4e, 0x0a, 0x0b, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x12, 0x39, + 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x62, 0x61, 0x74, 0x63, 0x68, 0x64, 0x62, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x04, 0xa0, 0xa6, 0x1d, 0x01, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x3a, 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x22, - 0xd7, 0x02, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x6f, - 0x0a, 0x08, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x42, 0x54, 0x82, 0xa6, 0x1d, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x63, 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x2f, 0x6d, 0x69, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, 0x67, 0x63, - 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, - 0x61, 0x74, 0x63, 0x68, 0x49, 0x44, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x12, - 0x51, 0x0a, 0x06, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x42, - 0x3a, 0x82, 0xa6, 0x1d, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x66, 0x69, 0x6c, 0x65, 0x63, 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x2f, 0x6d, 0x69, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x74, 0x6f, 0x72, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x78, 0x49, 0x44, 0x52, 0x05, 0x74, 0x78, 0x49, - 0x64, 0x73, 0x12, 0x28, 0x0a, 0x03, 0x74, 0x78, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x16, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x74, 0x6f, 0x72, 0x70, 0x62, 0x2e, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x74, 0x78, 0x73, 0x12, 0x1a, 0x0a, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, - 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x61, 0x74, 0x63, 0x68, - 0x64, 0x62, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x52, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x3a, 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x22, 0x4e, 0x0a, 0x0b, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x12, 0x39, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, - 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x61, 0x74, 0x63, 0x68, - 0x64, 0x62, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x04, 0xa0, 0xa6, 0x1d, 0x01, 0x52, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x3a, 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x22, 0xd9, 0x01, 0x0a, 0x11, 0x4c, 0x6f, - 0x6f, 0x6b, 0x75, 0x70, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, - 0x4e, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x36, 0x82, 0xa6, 0x1d, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x66, 0x69, 0x6c, 0x65, 0x63, 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x2f, 0x6d, 0x69, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x49, 0x44, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, - 0x3d, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x48, 0x00, - 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x21, - 0x0a, 0x03, 0x64, 0x73, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x64, 0x73, - 0x6c, 0x70, 0x62, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x03, 0x64, 0x73, - 0x6c, 0x3a, 0x04, 0x90, 0xa6, 0x1d, 0x01, 0x42, 0x0c, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x04, 0x80, 0xa6, 0x1d, 0x01, 0x22, 0xd8, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x42, - 0x61, 0x74, 0x63, 0x68, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x4e, 0x0a, 0x06, 0x6d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, 0x82, 0xa6, 0x1d, 0x32, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x63, - 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x6d, 0x69, 0x72, 0x2f, - 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, - 0x49, 0x44, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x70, 0x62, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x0c, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x21, 0x0a, 0x03, 0x64, 0x73, 0x6c, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x64, 0x73, 0x6c, 0x70, 0x62, 0x2e, 0x4f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x03, 0x64, 0x73, 0x6c, 0x3a, 0x04, 0x90, 0xa6, - 0x1d, 0x01, 0x42, 0x0c, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x04, 0x80, 0xa6, 0x1d, 0x01, - 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, - 0x69, 0x6c, 0x65, 0x63, 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, - 0x6d, 0x69, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x61, 0x76, 0x61, 0x69, 0x6c, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x70, 0x62, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x64, - 0x62, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x85, 0x01, 0x0a, 0x0e, 0x47, 0x61, 0x72, 0x62, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x12, 0x6d, 0x0a, 0x0f, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x44, 0x82, 0xa6, 0x1d, + 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x6c, 0x65, + 0x63, 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x6d, 0x69, 0x72, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x74, 0x6f, 0x72, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, + 0x78, 0x52, 0x0e, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, + 0x78, 0x3a, 0x04, 0x98, 0xa6, 0x1d, 0x01, 0x22, 0xd9, 0x01, 0x0a, 0x11, 0x4c, 0x6f, 0x6f, 0x6b, + 0x75, 0x70, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x4e, 0x0a, + 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, 0x82, + 0xa6, 0x1d, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, + 0x6c, 0x65, 0x63, 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x6d, + 0x69, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x49, 0x44, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x3d, 0x0a, + 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x70, 0x62, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x0c, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x21, 0x0a, 0x03, + 0x64, 0x73, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x64, 0x73, 0x6c, 0x70, + 0x62, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x03, 0x64, 0x73, 0x6c, 0x3a, + 0x04, 0x90, 0xa6, 0x1d, 0x01, 0x42, 0x0c, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x04, 0x80, + 0xa6, 0x1d, 0x01, 0x22, 0xd8, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x61, 0x74, + 0x63, 0x68, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x4e, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, 0x82, 0xa6, 0x1d, 0x32, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x63, 0x6f, 0x69, + 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x6d, 0x69, 0x72, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x49, 0x44, + 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x70, 0x62, + 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x78, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x21, 0x0a, 0x03, 0x64, 0x73, 0x6c, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x64, 0x73, 0x6c, 0x70, 0x62, 0x2e, 0x4f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x03, 0x64, 0x73, 0x6c, 0x3a, 0x04, 0x90, 0xa6, 0x1d, 0x01, + 0x42, 0x0c, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x04, 0x80, 0xa6, 0x1d, 0x01, 0x42, 0x41, + 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x6c, + 0x65, 0x63, 0x6f, 0x69, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x6d, 0x69, + 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x70, 0x62, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x64, 0x62, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -680,39 +746,41 @@ func file_availabilitypb_batchdbpb_batchdbpb_proto_rawDescGZIP() []byte { return file_availabilitypb_batchdbpb_batchdbpb_proto_rawDescData } -var file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_availabilitypb_batchdbpb_batchdbpb_proto_goTypes = []interface{}{ (*Event)(nil), // 0: batchdbpb.Event (*LookupBatch)(nil), // 1: batchdbpb.LookupBatch (*LookupBatchResponse)(nil), // 2: batchdbpb.LookupBatchResponse (*StoreBatch)(nil), // 3: batchdbpb.StoreBatch (*BatchStored)(nil), // 4: batchdbpb.BatchStored - (*LookupBatchOrigin)(nil), // 5: batchdbpb.LookupBatchOrigin - (*StoreBatchOrigin)(nil), // 6: batchdbpb.StoreBatchOrigin - (*trantorpb.Transaction)(nil), // 7: trantorpb.Transaction - (*contextstorepb.Origin)(nil), // 8: contextstorepb.Origin - (*dslpb.Origin)(nil), // 9: dslpb.Origin + (*GarbageCollect)(nil), // 5: batchdbpb.GarbageCollect + (*LookupBatchOrigin)(nil), // 6: batchdbpb.LookupBatchOrigin + (*StoreBatchOrigin)(nil), // 7: batchdbpb.StoreBatchOrigin + (*trantorpb.Transaction)(nil), // 8: trantorpb.Transaction + (*contextstorepb.Origin)(nil), // 9: contextstorepb.Origin + (*dslpb.Origin)(nil), // 10: dslpb.Origin } var file_availabilitypb_batchdbpb_batchdbpb_proto_depIdxs = []int32{ 1, // 0: batchdbpb.Event.lookup:type_name -> batchdbpb.LookupBatch 2, // 1: batchdbpb.Event.lookup_response:type_name -> batchdbpb.LookupBatchResponse 3, // 2: batchdbpb.Event.store:type_name -> batchdbpb.StoreBatch 4, // 3: batchdbpb.Event.stored:type_name -> batchdbpb.BatchStored - 5, // 4: batchdbpb.LookupBatch.origin:type_name -> batchdbpb.LookupBatchOrigin - 7, // 5: batchdbpb.LookupBatchResponse.txs:type_name -> trantorpb.Transaction - 5, // 6: batchdbpb.LookupBatchResponse.origin:type_name -> batchdbpb.LookupBatchOrigin - 7, // 7: batchdbpb.StoreBatch.txs:type_name -> trantorpb.Transaction - 6, // 8: batchdbpb.StoreBatch.origin:type_name -> batchdbpb.StoreBatchOrigin - 6, // 9: batchdbpb.BatchStored.origin:type_name -> batchdbpb.StoreBatchOrigin - 8, // 10: batchdbpb.LookupBatchOrigin.context_store:type_name -> contextstorepb.Origin - 9, // 11: batchdbpb.LookupBatchOrigin.dsl:type_name -> dslpb.Origin - 8, // 12: batchdbpb.StoreBatchOrigin.context_store:type_name -> contextstorepb.Origin - 9, // 13: batchdbpb.StoreBatchOrigin.dsl:type_name -> dslpb.Origin - 14, // [14:14] is the sub-list for method output_type - 14, // [14:14] is the sub-list for method input_type - 14, // [14:14] is the sub-list for extension type_name - 14, // [14:14] is the sub-list for extension extendee - 0, // [0:14] is the sub-list for field type_name + 5, // 4: batchdbpb.Event.garbage_collect:type_name -> batchdbpb.GarbageCollect + 6, // 5: batchdbpb.LookupBatch.origin:type_name -> batchdbpb.LookupBatchOrigin + 8, // 6: batchdbpb.LookupBatchResponse.txs:type_name -> trantorpb.Transaction + 6, // 7: batchdbpb.LookupBatchResponse.origin:type_name -> batchdbpb.LookupBatchOrigin + 8, // 8: batchdbpb.StoreBatch.txs:type_name -> trantorpb.Transaction + 7, // 9: batchdbpb.StoreBatch.origin:type_name -> batchdbpb.StoreBatchOrigin + 7, // 10: batchdbpb.BatchStored.origin:type_name -> batchdbpb.StoreBatchOrigin + 9, // 11: batchdbpb.LookupBatchOrigin.context_store:type_name -> contextstorepb.Origin + 10, // 12: batchdbpb.LookupBatchOrigin.dsl:type_name -> dslpb.Origin + 9, // 13: batchdbpb.StoreBatchOrigin.context_store:type_name -> contextstorepb.Origin + 10, // 14: batchdbpb.StoreBatchOrigin.dsl:type_name -> dslpb.Origin + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_availabilitypb_batchdbpb_batchdbpb_proto_init() } @@ -782,7 +850,7 @@ func file_availabilitypb_batchdbpb_batchdbpb_proto_init() { } } file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LookupBatchOrigin); i { + switch v := v.(*GarbageCollect); i { case 0: return &v.state case 1: @@ -794,6 +862,18 @@ func file_availabilitypb_batchdbpb_batchdbpb_proto_init() { } } file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LookupBatchOrigin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StoreBatchOrigin); i { case 0: return &v.state @@ -811,12 +891,13 @@ func file_availabilitypb_batchdbpb_batchdbpb_proto_init() { (*Event_LookupResponse)(nil), (*Event_Store)(nil), (*Event_Stored)(nil), + (*Event_GarbageCollect)(nil), } - file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[5].OneofWrappers = []interface{}{ + file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[6].OneofWrappers = []interface{}{ (*LookupBatchOrigin_ContextStore)(nil), (*LookupBatchOrigin_Dsl)(nil), } - file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[6].OneofWrappers = []interface{}{ + file_availabilitypb_batchdbpb_batchdbpb_proto_msgTypes[7].OneofWrappers = []interface{}{ (*StoreBatchOrigin_ContextStore)(nil), (*StoreBatchOrigin_Dsl)(nil), } @@ -826,7 +907,7 @@ func file_availabilitypb_batchdbpb_batchdbpb_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_availabilitypb_batchdbpb_batchdbpb_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/pb/availabilitypb/batchdbpb/batchdbpb.pb.mir.go b/pkg/pb/availabilitypb/batchdbpb/batchdbpb.pb.mir.go index 35865cbd9..41172202e 100644 --- a/pkg/pb/availabilitypb/batchdbpb/batchdbpb.pb.mir.go +++ b/pkg/pb/availabilitypb/batchdbpb/batchdbpb.pb.mir.go @@ -12,6 +12,7 @@ func (*Event) ReflectTypeOptions() []reflect.Type { reflect.TypeOf((*Event_LookupResponse)(nil)), reflect.TypeOf((*Event_Store)(nil)), reflect.TypeOf((*Event_Stored)(nil)), + reflect.TypeOf((*Event_GarbageCollect)(nil)), } } diff --git a/pkg/pb/availabilitypb/batchdbpb/dsl/emit.mir.go b/pkg/pb/availabilitypb/batchdbpb/dsl/emit.mir.go index f58a17f6d..e42020dcb 100644 --- a/pkg/pb/availabilitypb/batchdbpb/dsl/emit.mir.go +++ b/pkg/pb/availabilitypb/batchdbpb/dsl/emit.mir.go @@ -29,7 +29,7 @@ func LookupBatchResponse(m dsl.Module, destModule types.ModuleID, found bool, tx dsl.EmitMirEvent(m, events.LookupBatchResponse(destModule, found, txs, origin)) } -func StoreBatch[C any](m dsl.Module, destModule types.ModuleID, batchId types1.BatchID, txIds []types4.TxID, txs []*types3.Transaction, metadata []uint8, context *C) { +func StoreBatch[C any](m dsl.Module, destModule types.ModuleID, batchId types1.BatchID, txs []*types3.Transaction, retentionIndex types4.RetentionIndex, context *C) { contextID := m.DslHandle().StoreContext(context) origin := &types2.StoreBatchOrigin{ @@ -37,9 +37,13 @@ func StoreBatch[C any](m dsl.Module, destModule types.ModuleID, batchId types1.B Type: &types2.StoreBatchOrigin_Dsl{Dsl: dsl.MirOrigin(contextID)}, } - dsl.EmitMirEvent(m, events.StoreBatch(destModule, batchId, txIds, txs, metadata, origin)) + dsl.EmitMirEvent(m, events.StoreBatch(destModule, batchId, txs, retentionIndex, origin)) } func BatchStored(m dsl.Module, destModule types.ModuleID, origin *types2.StoreBatchOrigin) { dsl.EmitMirEvent(m, events.BatchStored(destModule, origin)) } + +func GarbageCollect(m dsl.Module, destModule types.ModuleID, retentionIndex types4.RetentionIndex) { + dsl.EmitMirEvent(m, events.GarbageCollect(destModule, retentionIndex)) +} diff --git a/pkg/pb/availabilitypb/batchdbpb/dsl/upon.mir.go b/pkg/pb/availabilitypb/batchdbpb/dsl/upon.mir.go index 884ca8065..daa995296 100644 --- a/pkg/pb/availabilitypb/batchdbpb/dsl/upon.mir.go +++ b/pkg/pb/availabilitypb/batchdbpb/dsl/upon.mir.go @@ -47,9 +47,9 @@ func UponLookupBatchResponse[C any](m dsl.Module, handler func(found bool, txs [ }) } -func UponStoreBatch(m dsl.Module, handler func(batchId types2.BatchID, txIds []types4.TxID, txs []*types3.Transaction, metadata []uint8, origin *types.StoreBatchOrigin) error) { +func UponStoreBatch(m dsl.Module, handler func(batchId types2.BatchID, txs []*types3.Transaction, retentionIndex types4.RetentionIndex, origin *types.StoreBatchOrigin) error) { UponEvent[*types.Event_Store](m, func(ev *types.StoreBatch) error { - return handler(ev.BatchId, ev.TxIds, ev.Txs, ev.Metadata, ev.Origin) + return handler(ev.BatchId, ev.Txs, ev.RetentionIndex, ev.Origin) }) } @@ -69,3 +69,9 @@ func UponBatchStored[C any](m dsl.Module, handler func(context *C) error) { return handler(context) }) } + +func UponGarbageCollect(m dsl.Module, handler func(retentionIndex types4.RetentionIndex) error) { + UponEvent[*types.Event_GarbageCollect](m, func(ev *types.GarbageCollect) error { + return handler(ev.RetentionIndex) + }) +} diff --git a/pkg/pb/availabilitypb/batchdbpb/events/events.mir.go b/pkg/pb/availabilitypb/batchdbpb/events/events.mir.go index 995f264fd..3d1135a46 100644 --- a/pkg/pb/availabilitypb/batchdbpb/events/events.mir.go +++ b/pkg/pb/availabilitypb/batchdbpb/events/events.mir.go @@ -44,18 +44,17 @@ func LookupBatchResponse(destModule types.ModuleID, found bool, txs []*types4.Tr } } -func StoreBatch(destModule types.ModuleID, batchId types1.BatchID, txIds []types5.TxID, txs []*types4.Transaction, metadata []uint8, origin *types2.StoreBatchOrigin) *types3.Event { +func StoreBatch(destModule types.ModuleID, batchId types1.BatchID, txs []*types4.Transaction, retentionIndex types5.RetentionIndex, origin *types2.StoreBatchOrigin) *types3.Event { return &types3.Event{ DestModule: destModule, Type: &types3.Event_BatchDb{ BatchDb: &types2.Event{ Type: &types2.Event_Store{ Store: &types2.StoreBatch{ - BatchId: batchId, - TxIds: txIds, - Txs: txs, - Metadata: metadata, - Origin: origin, + BatchId: batchId, + Txs: txs, + RetentionIndex: retentionIndex, + Origin: origin, }, }, }, @@ -77,3 +76,18 @@ func BatchStored(destModule types.ModuleID, origin *types2.StoreBatchOrigin) *ty }, } } + +func GarbageCollect(destModule types.ModuleID, retentionIndex types5.RetentionIndex) *types3.Event { + return &types3.Event{ + DestModule: destModule, + Type: &types3.Event_BatchDb{ + BatchDb: &types2.Event{ + Type: &types2.Event_GarbageCollect{ + GarbageCollect: &types2.GarbageCollect{ + RetentionIndex: retentionIndex, + }, + }, + }, + }, + } +} diff --git a/pkg/pb/availabilitypb/batchdbpb/oneof_interfaces.mir.go b/pkg/pb/availabilitypb/batchdbpb/oneof_interfaces.mir.go index 0b2f52731..da0c62425 100644 --- a/pkg/pb/availabilitypb/batchdbpb/oneof_interfaces.mir.go +++ b/pkg/pb/availabilitypb/batchdbpb/oneof_interfaces.mir.go @@ -30,6 +30,10 @@ func (w *Event_Stored) Unwrap() *BatchStored { return w.Stored } +func (w *Event_GarbageCollect) Unwrap() *GarbageCollect { + return w.GarbageCollect +} + type LookupBatchOrigin_Type = isLookupBatchOrigin_Type type LookupBatchOrigin_TypeWrapper[T any] interface { diff --git a/pkg/pb/availabilitypb/batchdbpb/types/types.mir.go b/pkg/pb/availabilitypb/batchdbpb/types/types.mir.go index 2eac18cc9..02152eacb 100644 --- a/pkg/pb/availabilitypb/batchdbpb/types/types.mir.go +++ b/pkg/pb/availabilitypb/batchdbpb/types/types.mir.go @@ -44,6 +44,8 @@ func Event_TypeFromPb(pb batchdbpb.Event_Type) Event_Type { return &Event_Store{Store: StoreBatchFromPb(pb.Store)} case *batchdbpb.Event_Stored: return &Event_Stored{Stored: BatchStoredFromPb(pb.Stored)} + case *batchdbpb.Event_GarbageCollect: + return &Event_GarbageCollect{GarbageCollect: GarbageCollectFromPb(pb.GarbageCollect)} } return nil } @@ -144,6 +146,30 @@ func (*Event_Stored) MirReflect() mirreflect.Type { return mirreflect.TypeImpl{PbType_: reflectutil.TypeOf[*batchdbpb.Event_Stored]()} } +type Event_GarbageCollect struct { + GarbageCollect *GarbageCollect +} + +func (*Event_GarbageCollect) isEvent_Type() {} + +func (w *Event_GarbageCollect) Unwrap() *GarbageCollect { + return w.GarbageCollect +} + +func (w *Event_GarbageCollect) Pb() batchdbpb.Event_Type { + if w == nil { + return nil + } + if w.GarbageCollect == nil { + return &batchdbpb.Event_GarbageCollect{} + } + return &batchdbpb.Event_GarbageCollect{GarbageCollect: (w.GarbageCollect).Pb()} +} + +func (*Event_GarbageCollect) MirReflect() mirreflect.Type { + return mirreflect.TypeImpl{PbType_: reflectutil.TypeOf[*batchdbpb.Event_GarbageCollect]()} +} + func EventFromPb(pb *batchdbpb.Event) *Event { if pb == nil { return nil @@ -247,11 +273,10 @@ func (*LookupBatchResponse) MirReflect() mirreflect.Type { } type StoreBatch struct { - BatchId types.BatchID - TxIds []types3.TxID - Txs []*types1.Transaction - Metadata []uint8 - Origin *StoreBatchOrigin + BatchId types.BatchID + Txs []*types1.Transaction + RetentionIndex types3.RetentionIndex + Origin *StoreBatchOrigin } func StoreBatchFromPb(pb *batchdbpb.StoreBatch) *StoreBatch { @@ -260,14 +285,11 @@ func StoreBatchFromPb(pb *batchdbpb.StoreBatch) *StoreBatch { } return &StoreBatch{ BatchId: (types.BatchID)(pb.BatchId), - TxIds: types2.ConvertSlice(pb.TxIds, func(t []uint8) types3.TxID { - return (types3.TxID)(t) - }), Txs: types2.ConvertSlice(pb.Txs, func(t *trantorpb.Transaction) *types1.Transaction { return types1.TransactionFromPb(t) }), - Metadata: pb.Metadata, - Origin: StoreBatchOriginFromPb(pb.Origin), + RetentionIndex: (types3.RetentionIndex)(pb.RetentionIndex), + Origin: StoreBatchOriginFromPb(pb.Origin), } } @@ -278,13 +300,10 @@ func (m *StoreBatch) Pb() *batchdbpb.StoreBatch { pbMessage := &batchdbpb.StoreBatch{} { pbMessage.BatchId = ([]uint8)(m.BatchId) - pbMessage.TxIds = types2.ConvertSlice(m.TxIds, func(t types3.TxID) []uint8 { - return ([]uint8)(t) - }) pbMessage.Txs = types2.ConvertSlice(m.Txs, func(t *types1.Transaction) *trantorpb.Transaction { return (t).Pb() }) - pbMessage.Metadata = m.Metadata + pbMessage.RetentionIndex = (uint64)(m.RetentionIndex) if m.Origin != nil { pbMessage.Origin = (m.Origin).Pb() } @@ -328,6 +347,35 @@ func (*BatchStored) MirReflect() mirreflect.Type { return mirreflect.TypeImpl{PbType_: reflectutil.TypeOf[*batchdbpb.BatchStored]()} } +type GarbageCollect struct { + RetentionIndex types3.RetentionIndex +} + +func GarbageCollectFromPb(pb *batchdbpb.GarbageCollect) *GarbageCollect { + if pb == nil { + return nil + } + return &GarbageCollect{ + RetentionIndex: (types3.RetentionIndex)(pb.RetentionIndex), + } +} + +func (m *GarbageCollect) Pb() *batchdbpb.GarbageCollect { + if m == nil { + return nil + } + pbMessage := &batchdbpb.GarbageCollect{} + { + pbMessage.RetentionIndex = (uint64)(m.RetentionIndex) + } + + return pbMessage +} + +func (*GarbageCollect) MirReflect() mirreflect.Type { + return mirreflect.TypeImpl{PbType_: reflectutil.TypeOf[*batchdbpb.GarbageCollect]()} +} + type LookupBatchOrigin struct { Module types4.ModuleID Type LookupBatchOrigin_Type diff --git a/pkg/trantor/moduleconfig.go b/pkg/trantor/moduleconfig.go index f5120a5b0..de74ffd4b 100644 --- a/pkg/trantor/moduleconfig.go +++ b/pkg/trantor/moduleconfig.go @@ -58,6 +58,7 @@ func (mc ModuleConfig) ConfigureISS() iss.ModuleConfig { Self: mc.ISS, App: mc.BatchFetcher, Availability: mc.Availability, + BatchDB: mc.BatchDB, Checkpoint: mc.Checkpointing, ChkpValidator: mc.ChkpValidator, Net: mc.Net, diff --git a/protos/availabilitypb/batchdbpb/batchdbpb.proto b/protos/availabilitypb/batchdbpb/batchdbpb.proto index 0e8e0069a..4157f0f8d 100644 --- a/protos/availabilitypb/batchdbpb/batchdbpb.proto +++ b/protos/availabilitypb/batchdbpb/batchdbpb.proto @@ -24,6 +24,7 @@ message Event { LookupBatchResponse lookup_response = 2; StoreBatch store = 3; BatchStored stored = 4; + GarbageCollect garbage_collect = 5; } } @@ -39,20 +40,19 @@ message LookupBatch { message LookupBatchResponse { option (mir.event) = true; - bool found = 1; + bool found = 1; repeated trantorpb.Transaction txs = 2; - LookupBatchOrigin origin = 3 [(mir.origin_response) = true]; + LookupBatchOrigin origin = 3 [(mir.origin_response) = true]; } // StoreBatch is used to store a new batch in the local batch database. message StoreBatch { option (mir.event) = true; - bytes batch_id = 1 [(mir.type) = "github.com/filecoin-project/mir/pkg/availability/multisigcollector/types.BatchID"]; - repeated bytes tx_ids = 2 [(mir.type) = "github.com/filecoin-project/mir/pkg/trantor/types.TxID"]; - repeated trantorpb.Transaction txs = 3; - bytes metadata = 4; // not used at the moment - StoreBatchOrigin origin = 5 [(mir.origin_request) = true]; + bytes batch_id = 1 [(mir.type) = "github.com/filecoin-project/mir/pkg/availability/multisigcollector/types.BatchID"]; + repeated trantorpb.Transaction txs = 2; + uint64 retention_index = 3 [(mir.type) = "github.com/filecoin-project/mir/pkg/trantor/types.RetentionIndex"]; + StoreBatchOrigin origin = 4 [(mir.origin_request) = true]; } // BatchStored is a response to a VerifyCert event. @@ -62,6 +62,12 @@ message BatchStored { StoreBatchOrigin origin = 1 [(mir.origin_response) = true]; } +message GarbageCollect { + option (mir.event) = true; + + uint64 retention_index = 1 [(mir.type) = "github.com/filecoin-project/mir/pkg/trantor/types.RetentionIndex"]; +} + // ============================================================ // Data structures // ============================================================