mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-19 19:03:54 +01:00
* filer: POSIX advisory lock set primitive (phase 1) Pure per-inode conflict/coalesce/range-split logic for fcntl byte-range and flock whole-file locks, extracted from the mount's PosixLockTable without its wait queue or inode-map concurrency. Owner identity is (Sid, Owner) so the same FUSE owner on different mounts never aliases, and ReleaseSession reaps a dead mount's locks. The owner filer will hold one Set per inode under the per-path lock; no concurrency control here. * test: tolerate transient FUSE invisibility in ConcurrentReadWrite A concurrent truncating overwrite leaves a short-lived dentry/cache window where the file is momentarily ENOENT to another opener. Retry the reads and writes a few times before failing, as ConcurrentDirectoryOperations does. * filer: serialize the POSIX lock set for entry metadata Versioned fixed-width binary encoding of a Set, so an inode's held locks can ride in its entry metadata: a lock op materializes the Set from the blob, applies under the per-path lock, and writes it back. Empty set encodes to nil so a lock-free inode carries no blob. * filer: encode the POSIX lock set as protobuf Replace the hand-rolled fixed-width codec with a LockSetProto message, so the metadata blob can gain fields without a format-version migration. proto.Unmarshal already rejects a malformed blob, so the explicit version and length checks go away. Marshal now returns an error to match.
231 lines
6.6 KiB
Go
231 lines
6.6 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-go v1.36.6
|
|
// protoc v6.33.4
|
|
// source: posix_lock.proto
|
|
|
|
package posixlock
|
|
|
|
import (
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
reflect "reflect"
|
|
sync "sync"
|
|
unsafe "unsafe"
|
|
)
|
|
|
|
const (
|
|
// Verify that this generated code is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
)
|
|
|
|
// LockSetProto is the serialized set of advisory locks held on one inode. It
|
|
// rides in the inode's entry metadata, so the schema must stay backward
|
|
// compatible across filer versions.
|
|
type LockSetProto struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Locks []*LockProto `protobuf:"bytes,1,rep,name=locks,proto3" json:"locks,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *LockSetProto) Reset() {
|
|
*x = LockSetProto{}
|
|
mi := &file_posix_lock_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *LockSetProto) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*LockSetProto) ProtoMessage() {}
|
|
|
|
func (x *LockSetProto) ProtoReflect() protoreflect.Message {
|
|
mi := &file_posix_lock_proto_msgTypes[0]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use LockSetProto.ProtoReflect.Descriptor instead.
|
|
func (*LockSetProto) Descriptor() ([]byte, []int) {
|
|
return file_posix_lock_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *LockSetProto) GetLocks() []*LockProto {
|
|
if x != nil {
|
|
return x.Locks
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// LockProto mirrors Range. Owner identity is the (sid, owner) pair; end is
|
|
// inclusive and max uint64 means EOF; is_flock separates the flock and fcntl
|
|
// namespaces, which never conflict.
|
|
type LockProto struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Start uint64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"`
|
|
End uint64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"`
|
|
Type uint32 `protobuf:"varint,3,opt,name=type,proto3" json:"type,omitempty"`
|
|
Sid uint64 `protobuf:"varint,4,opt,name=sid,proto3" json:"sid,omitempty"`
|
|
Owner uint64 `protobuf:"varint,5,opt,name=owner,proto3" json:"owner,omitempty"`
|
|
Pid uint32 `protobuf:"varint,6,opt,name=pid,proto3" json:"pid,omitempty"`
|
|
IsFlock bool `protobuf:"varint,7,opt,name=is_flock,json=isFlock,proto3" json:"is_flock,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *LockProto) Reset() {
|
|
*x = LockProto{}
|
|
mi := &file_posix_lock_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *LockProto) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*LockProto) ProtoMessage() {}
|
|
|
|
func (x *LockProto) ProtoReflect() protoreflect.Message {
|
|
mi := &file_posix_lock_proto_msgTypes[1]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use LockProto.ProtoReflect.Descriptor instead.
|
|
func (*LockProto) Descriptor() ([]byte, []int) {
|
|
return file_posix_lock_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *LockProto) GetStart() uint64 {
|
|
if x != nil {
|
|
return x.Start
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *LockProto) GetEnd() uint64 {
|
|
if x != nil {
|
|
return x.End
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *LockProto) GetType() uint32 {
|
|
if x != nil {
|
|
return x.Type
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *LockProto) GetSid() uint64 {
|
|
if x != nil {
|
|
return x.Sid
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *LockProto) GetOwner() uint64 {
|
|
if x != nil {
|
|
return x.Owner
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *LockProto) GetPid() uint32 {
|
|
if x != nil {
|
|
return x.Pid
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *LockProto) GetIsFlock() bool {
|
|
if x != nil {
|
|
return x.IsFlock
|
|
}
|
|
return false
|
|
}
|
|
|
|
var File_posix_lock_proto protoreflect.FileDescriptor
|
|
|
|
const file_posix_lock_proto_rawDesc = "" +
|
|
"\n" +
|
|
"\x10posix_lock.proto\x12\tposixlock\":\n" +
|
|
"\fLockSetProto\x12*\n" +
|
|
"\x05locks\x18\x01 \x03(\v2\x14.posixlock.LockProtoR\x05locks\"\x9c\x01\n" +
|
|
"\tLockProto\x12\x14\n" +
|
|
"\x05start\x18\x01 \x01(\x04R\x05start\x12\x10\n" +
|
|
"\x03end\x18\x02 \x01(\x04R\x03end\x12\x12\n" +
|
|
"\x04type\x18\x03 \x01(\rR\x04type\x12\x10\n" +
|
|
"\x03sid\x18\x04 \x01(\x04R\x03sid\x12\x14\n" +
|
|
"\x05owner\x18\x05 \x01(\x04R\x05owner\x12\x10\n" +
|
|
"\x03pid\x18\x06 \x01(\rR\x03pid\x12\x19\n" +
|
|
"\bis_flock\x18\a \x01(\bR\aisFlockB5Z3github.com/seaweedfs/seaweedfs/weed/filer/posixlockb\x06proto3"
|
|
|
|
var (
|
|
file_posix_lock_proto_rawDescOnce sync.Once
|
|
file_posix_lock_proto_rawDescData []byte
|
|
)
|
|
|
|
func file_posix_lock_proto_rawDescGZIP() []byte {
|
|
file_posix_lock_proto_rawDescOnce.Do(func() {
|
|
file_posix_lock_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_posix_lock_proto_rawDesc), len(file_posix_lock_proto_rawDesc)))
|
|
})
|
|
return file_posix_lock_proto_rawDescData
|
|
}
|
|
|
|
var file_posix_lock_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
|
var file_posix_lock_proto_goTypes = []any{
|
|
(*LockSetProto)(nil), // 0: posixlock.LockSetProto
|
|
(*LockProto)(nil), // 1: posixlock.LockProto
|
|
}
|
|
var file_posix_lock_proto_depIdxs = []int32{
|
|
1, // 0: posixlock.LockSetProto.locks:type_name -> posixlock.LockProto
|
|
1, // [1:1] is the sub-list for method output_type
|
|
1, // [1:1] is the sub-list for method input_type
|
|
1, // [1:1] is the sub-list for extension type_name
|
|
1, // [1:1] is the sub-list for extension extendee
|
|
0, // [0:1] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_posix_lock_proto_init() }
|
|
func file_posix_lock_proto_init() {
|
|
if File_posix_lock_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_posix_lock_proto_rawDesc), len(file_posix_lock_proto_rawDesc)),
|
|
NumEnums: 0,
|
|
NumMessages: 2,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_posix_lock_proto_goTypes,
|
|
DependencyIndexes: file_posix_lock_proto_depIdxs,
|
|
MessageInfos: file_posix_lock_proto_msgTypes,
|
|
}.Build()
|
|
File_posix_lock_proto = out.File
|
|
file_posix_lock_proto_goTypes = nil
|
|
file_posix_lock_proto_depIdxs = nil
|
|
}
|