From b09b1a900b8a7bfd2afa6a02ee117ae4c3d29a8b Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 16 Oct 2026 01:31:44 -0700 Subject: [PATCH] filer_pb: add condition_alt_key to ObjectTransactionRequest --- weed/pb/filer.proto | 1 + weed/pb/filer_pb/filer.pb.go | 20 +++++++++---- weed/pb/filer_pb/filer_vtproto.pb.go | 43 ++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/weed/pb/filer.proto b/weed/pb/filer.proto index a97fbfdf95..bfa1de2912 100644 --- a/weed/pb/filer.proto +++ b/weed/pb/filer.proto @@ -392,6 +392,7 @@ message ObjectTransactionRequest { string condition_key = 6; // if set, evaluate the condition against this entry instead of lock_key (still locking lock_key) string route_key = 7; // ring key identifying the owner filer; a non-owner forwards the whole transaction to it bool is_moved = 8; // set on a forwarded transaction so the receiver applies it locally instead of forwarding again + string condition_alt_key = 10; // if the condition's entry is absent, evaluate it against this entry instead (e.g. null slot, else latest version) } message ObjectTransactionResponse { diff --git a/weed/pb/filer_pb/filer.pb.go b/weed/pb/filer_pb/filer.pb.go index fe0d0767a8..1d82746e26 100644 --- a/weed/pb/filer_pb/filer.pb.go +++ b/weed/pb/filer_pb/filer.pb.go @@ -1811,9 +1811,10 @@ type ObjectTransactionRequest struct { Mutations []*ObjectMutation `protobuf:"bytes,3,rep,name=mutations,proto3" json:"mutations,omitempty"` IsFromOtherCluster bool `protobuf:"varint,4,opt,name=is_from_other_cluster,json=isFromOtherCluster,proto3" json:"is_from_other_cluster,omitempty"` Signatures []int32 `protobuf:"varint,5,rep,packed,name=signatures,proto3" json:"signatures,omitempty"` - ConditionKey string `protobuf:"bytes,6,opt,name=condition_key,json=conditionKey,proto3" json:"condition_key,omitempty"` // if set, evaluate the condition against this entry instead of lock_key (still locking lock_key) - RouteKey string `protobuf:"bytes,7,opt,name=route_key,json=routeKey,proto3" json:"route_key,omitempty"` // ring key identifying the owner filer; a non-owner forwards the whole transaction to it - IsMoved bool `protobuf:"varint,8,opt,name=is_moved,json=isMoved,proto3" json:"is_moved,omitempty"` // set on a forwarded transaction so the receiver applies it locally instead of forwarding again + ConditionKey string `protobuf:"bytes,6,opt,name=condition_key,json=conditionKey,proto3" json:"condition_key,omitempty"` // if set, evaluate the condition against this entry instead of lock_key (still locking lock_key) + RouteKey string `protobuf:"bytes,7,opt,name=route_key,json=routeKey,proto3" json:"route_key,omitempty"` // ring key identifying the owner filer; a non-owner forwards the whole transaction to it + IsMoved bool `protobuf:"varint,8,opt,name=is_moved,json=isMoved,proto3" json:"is_moved,omitempty"` // set on a forwarded transaction so the receiver applies it locally instead of forwarding again + ConditionAltKey string `protobuf:"bytes,10,opt,name=condition_alt_key,json=conditionAltKey,proto3" json:"condition_alt_key,omitempty"` // if the condition's entry is absent, evaluate it against this entry instead (e.g. null slot, else latest version) unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1904,6 +1905,13 @@ func (x *ObjectTransactionRequest) GetIsMoved() bool { return false } +func (x *ObjectTransactionRequest) GetConditionAltKey() string { + if x != nil { + return x.ConditionAltKey + } + return "" +} + type ObjectTransactionResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` @@ -7433,7 +7441,7 @@ const file_filer_proto_rawDesc = "" + "\fexclude_name\x18\t \x01(\tR\vexcludeName\x1a?\n" + "\x11CopyExtendedEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xd5\x02\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x81\x03\n" + "\x18ObjectTransactionRequest\x12\x19\n" + "\block_key\x18\x01 \x01(\tR\alockKey\x126\n" + "\tcondition\x18\x02 \x01(\v2\x18.filer_pb.WriteConditionR\tcondition\x126\n" + @@ -7444,7 +7452,9 @@ const file_filer_proto_rawDesc = "" + "signatures\x12#\n" + "\rcondition_key\x18\x06 \x01(\tR\fconditionKey\x12\x1b\n" + "\troute_key\x18\a \x01(\tR\brouteKey\x12\x19\n" + - "\bis_moved\x18\b \x01(\bR\aisMoved\"f\n" + + "\bis_moved\x18\b \x01(\bR\aisMoved\x12*\n" + + "\x11condition_alt_key\x18\n" + + " \x01(\tR\x0fconditionAltKey\"f\n" + "\x19ObjectTransactionResponse\x12\x14\n" + "\x05error\x18\x01 \x01(\tR\x05error\x123\n" + "\n" + diff --git a/weed/pb/filer_pb/filer_vtproto.pb.go b/weed/pb/filer_pb/filer_vtproto.pb.go index 46d4b6e0c6..e11dd00454 100644 --- a/weed/pb/filer_pb/filer_vtproto.pb.go +++ b/weed/pb/filer_pb/filer_vtproto.pb.go @@ -1567,6 +1567,13 @@ func (m *ObjectTransactionRequest) MarshalToSizedBufferVT(dAtA []byte) (int, err i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if len(m.ConditionAltKey) > 0 { + i -= len(m.ConditionAltKey) + copy(dAtA[i:], m.ConditionAltKey) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ConditionAltKey))) + i-- + dAtA[i] = 0x52 + } if m.IsMoved { i-- if m.IsMoved { @@ -7188,6 +7195,10 @@ func (m *ObjectTransactionRequest) SizeVT() (n int) { if m.IsMoved { n += 2 } + l = len(m.ConditionAltKey) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } n += len(m.unknownFields) return n } @@ -13841,6 +13852,38 @@ func (m *ObjectTransactionRequest) UnmarshalVT(dAtA []byte) error { } } m.IsMoved = bool(v != 0) + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConditionAltKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConditionAltKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:])