metanode

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 53 Imported by: 8

Documentation

Index

Constants

View Source
const (
	DefaultNameResolveInterval   = 1 // minutes
	DefaultRaftNumOfLogsToRetain = 20000 * 2
)
View Source
const (
	KB = 1 << (10 * iota)
	MB
	GB
)
View Source
const (
	DeleteMarkFlag = 1 << 0
	InodeDelTop    = 1 << 1
)
View Source
const (
	ForceClosedConnect = true
	NoClosedConnect    = false
)
View Source
const (
	StatPeriod = time.Minute * time.Duration(1)

	MetricMetaFailedPartition      = "meta_failed_partition"
	MetricMetaPartitionInodeCount  = "mpInodeCount"
	MetricMetaPartitionDentryCount = "mpDentryCount"
	MetricConnectionCount          = "connectionCnt"
)

metrics

View Source
const (
	UpdateNodeInfoTicket     = 1 * time.Minute
	DefaultDeleteBatchCounts = 128
)
View Source
const (
	CRC_COUNT_BASIC      int = 4
	CRC_COUNT_TX_STUFF   int = 7
	CRC_COUNT_UINQ_STUFF int = 8
	CRC_COUNT_MULTI_VER  int = 9
)
View Source
const (
	Size1K   uint64 = 2 << 10
	Size1M   uint64 = 2 << 20
	Size16M         = 16 * Size1M
	Size32M         = 32 * Size1M
	Size64M         = 64 * Size1M
	Size128M        = 128 * Size1M
	Size256M        = 256 * Size1M
)
View Source
const (
	AsyncDeleteInterval           = 10 * time.Second
	BatchCounts                   = 128
	OpenRWAppendOpt               = os.O_CREATE | os.O_RDWR | os.O_APPEND
	TempFileValidTime             = 86400 // units: sec
	DeleteInodeFileExtension      = "INODE_DEL"
	DeleteWorkerCnt               = 10
	InodeNLink0DelayDeleteSeconds = 24 * 3600
	DeleteInodeFileRollingSize    = 500 * util.MB
)
View Source
const (
	MinDeleteBatchCounts = 100
	MaxSleepCnt          = 10
)
View Source
const (
	// initial version
	SnapFormatVersion_0 uint32 = iota

	// version since transaction feature, added formatVersion, txId and cursor in MetaItemIterator struct
	SnapFormatVersion_1
)
View Source
const (
	SiwKeySnapFormatVer uint32 = iota
	SiwKeyApplyId
	SiwKeyTxId
	SiwKeyCursor
	SiwKeyUniqId
	SiwKeyVerList
)

SnapItemWrapper key definition

View Source
const (
	TxIDFile     = "transactionID"
	SnapshotSign = ".sign"

	StaleMetadataSuffix     = ".old"
	StaleMetadataTimeFormat = "20060102150405.000000000"
)
View Source
const (
	TxNoOp uint8 = iota
	TxUpdate
	TxDelete
	TxAdd
)

Rollback Type

View Source
const (
	CrcUint32Size = 4
)
View Source
const (
	ExpiredPartitionPrefix = "expired_"
)
View Source
const (
	MaxUsedMemFactor = 1.1
)
View Source
const UpdateVolTicket = 2 * time.Minute

Variables

View Source
var (
	ErrNoLeader   = errors.New("no leader")
	ErrNotALeader = errors.New("not a leader")
)
View Source
var (
	// InodeV1Flag uint64 = 0x01
	V2EnableColdInodeFlag uint64 = 0x02
	V3EnableSnapInodeFlag uint64 = 0x04
)
View Source
var (
	ErrIllegalHeartbeatAddress = errors.New("illegal heartbeat address")
	ErrIllegalReplicateAddress = errors.New("illegal replicate address")
	ErrSnapshotCrcMismatch     = errors.New("snapshot crc not match")
)
View Source
var (
	ErrInodeIDOutOfRange = errors.New("inode ID out of range")
)

Errors

Functions

func DeleteBatchCount added in v1.34.0

func DeleteBatchCount() uint64

func DeleteWorkerSleepMs added in v1.34.0

func DeleteWorkerSleepMs()

func InodeOnceLinkMarshal added in v1.34.0

func InodeOnceLinkMarshal(req *LinkInodeReq) []byte

func InodeOnceUnlinkMarshal added in v1.34.0

func InodeOnceUnlinkMarshal(req *UnlinkInoReq) []byte

Types

type APIResponse

type APIResponse struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data,omitempty"`
}

APIResponse defines the structure of the response to an HTTP request

func NewAPIResponse

func NewAPIResponse(code int, msg string) *APIResponse

NewAPIResponse returns a new API response.

func (*APIResponse) Marshal

func (api *APIResponse) Marshal() ([]byte, error)

Marshal is a wrapper function of json.Marshal

type AppendExtParam added in v1.34.0

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

type BTree

type BTree struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

BTree is the wrapper of Google's btree.

func NewBtree

func NewBtree() *BTree

NewBtree creates a new btree.

func (*BTree) Ascend

func (b *BTree) Ascend(fn func(i BtreeItem) bool)

Ascend is the wrapper of the google's btree Ascend. This function scans the entire btree. When the data is huge, it is not recommended to use this function online. Instead, it is recommended to call GetTree to obtain the snapshot of the current btree, and then do the scan on the snapshot.

func (*BTree) AscendGreaterOrEqual

func (b *BTree) AscendGreaterOrEqual(pivot BtreeItem, iterator func(i BtreeItem) bool)

AscendGreaterOrEqual is the wrapper of the google's btree AscendGreaterOrEqual

func (*BTree) AscendRange

func (b *BTree) AscendRange(greaterOrEqual, lessThan BtreeItem, iterator func(i BtreeItem) bool)

AscendRange is the wrapper of the google's btree AscendRange.

func (*BTree) CopyFind

func (b *BTree) CopyFind(key BtreeItem, fn func(i BtreeItem))

func (*BTree) CopyGet

func (b *BTree) CopyGet(key BtreeItem) (item BtreeItem)

func (*BTree) Delete

func (b *BTree) Delete(key BtreeItem) (item BtreeItem)

Delete deletes the object by the given key.

func (*BTree) Execute added in v1.34.0

func (b *BTree) Execute(fn func(tree *btree.BTree) interface{}) interface{}

func (*BTree) Find

func (b *BTree) Find(key BtreeItem, fn func(i BtreeItem))

Find searches for the given key in the btree.

func (*BTree) Get

func (b *BTree) Get(key BtreeItem) (item BtreeItem)

Get returns the object of the given key in the btree.

func (*BTree) GetTree

func (b *BTree) GetTree() *BTree

GetTree returns the snapshot of a btree.

func (*BTree) Has

func (b *BTree) Has(key BtreeItem) (ok bool)

Has checks if the key exists in the btree.

func (*BTree) Len

func (b *BTree) Len() (size int)

Len returns the total number of items in the btree.

func (*BTree) MaxItem

func (b *BTree) MaxItem() BtreeItem

MaxItem returns the largest item in the btree.

func (*BTree) ReplaceOrInsert

func (b *BTree) ReplaceOrInsert(key BtreeItem, replace bool) (item BtreeItem, ok bool)

ReplaceOrInsert is the wrapper of google's btree ReplaceOrInsert.

func (*BTree) Reset

func (b *BTree) Reset()

Reset resets the current btree.

type BatchDeleteDentryReq added in v1.34.0

type BatchDeleteDentryReq = proto.BatchDeleteDentryRequest

Client -> MetaNode delete Dentry request

type BatchDeleteDentryResp added in v1.34.0

type BatchDeleteDentryResp = proto.BatchDeleteDentryResponse

MetaNode -> Client batch delete Dentry response

type BatchEvictInodeReq added in v1.34.0

type BatchEvictInodeReq = proto.BatchEvictInodeRequest

Client -> MetaNode

type BatchUnlinkInoReq added in v1.34.0

type BatchUnlinkInoReq = proto.BatchUnlinkInodeRequest

Client -> MetaNode delete Inode request struct

type BatchUnlinkInoResp added in v1.34.0

type BatchUnlinkInoResp = proto.BatchUnlinkInodeResponse

MetaNode -> Client delete batch Inode response

type BtreeItem

type BtreeItem = btree.Item

BtreeItem type alias google btree Item

type CreateDentryReq

type CreateDentryReq = proto.CreateDentryRequest

Client -> MetaNode create Dentry request struct

type CreateInoReq

type CreateInoReq = proto.CreateInodeRequest

Client -> MetaNode create Inode request

type CreateInoResp

type CreateInoResp = proto.CreateInodeResponse

MetaNode -> Client create Inode response

type CreateMetaRangeReq

type CreateMetaRangeReq = proto.CreateMetaPartitionRequest

Master -> MetaNode create metaPartition request

type CreateMetaRangeResp

type CreateMetaRangeResp = proto.CreateMetaPartitionResponse

MetaNode -> Master create metaPartition response

type DataPartition

type DataPartition struct {
	PartitionID   uint64
	Status        int8
	ReplicaNum    uint8
	PartitionType string
	Hosts         []string
	IsDiscard     bool
}

DataPartition defines the struct of data partition that will be used on the meta node.

func (*DataPartition) GetAllAddrs

func (dp *DataPartition) GetAllAddrs() (m string)

GetAllAddrs returns all addresses of the data partition.

type DataPartitionsView

type DataPartitionsView struct {
	DataPartitions []*DataPartition
}

DataPartitionsView defines the view of the data node.

func NewDataPartitionsView

func NewDataPartitionsView() *DataPartitionsView

type DelExtFile added in v1.34.0

type DelExtFile []os.FileInfo

func (DelExtFile) Len added in v1.34.0

func (del DelExtFile) Len() int

func (DelExtFile) Less added in v1.34.0

func (del DelExtFile) Less(i, j int) bool

func (DelExtFile) Swap added in v1.34.0

func (del DelExtFile) Swap(i, j int)

type DeleteDentryReq

type DeleteDentryReq = proto.DeleteDentryRequest

Client -> MetaNode delete Dentry request

type DeleteDentryResp

type DeleteDentryResp = proto.DeleteDentryResponse

MetaNode -> Client delete Dentry response

type Dentry

type Dentry struct {
	ParentId uint64 // FileID value of the parent inode.
	Name     string // Name of the current dentry.
	Inode    uint64 // FileID value of the current inode.
	Type     uint32
	// contains filtered or unexported fields
}

func (*Dentry) Copy

func (d *Dentry) Copy() BtreeItem

func (*Dentry) CopyDirectly added in v1.34.0

func (d *Dentry) CopyDirectly() BtreeItem

func (*Dentry) Less

func (d *Dentry) Less(than BtreeItem) (less bool)

Less tests whether the current dentry is less than the given one. This method is necessary fot B-Tree item implementation.

func (*Dentry) Marshal

func (d *Dentry) Marshal() (result []byte, err error)

Marshal marshals a dentry into a byte array.

func (*Dentry) MarshalKey

func (d *Dentry) MarshalKey() (k []byte)

MarshalKey is the bytes version of the MarshalKey method which returns the byte slice result.

func (*Dentry) MarshalValue

func (d *Dentry) MarshalValue() []byte

func (*Dentry) String added in v1.34.0

func (d *Dentry) String() string

func (*Dentry) Unmarshal

func (d *Dentry) Unmarshal(raw []byte) (err error)

Unmarshal unmarshals the dentry from a byte array.

func (*Dentry) UnmarshalKey

func (d *Dentry) UnmarshalKey(k []byte) (err error)

UnmarshalKey unmarshals the exporterKey from bytes.

func (*Dentry) UnmarshalValue

func (d *Dentry) UnmarshalValue(val []byte) (err error)

type DentryBatch added in v1.34.0

type DentryBatch []*Dentry

func DentryBatchUnmarshal added in v1.34.0

func DentryBatchUnmarshal(raw []byte) (DentryBatch, error)

Unmarshal unmarshals the dentryBatch.

func (DentryBatch) Marshal added in v1.34.0

func (d DentryBatch) Marshal() ([]byte, error)

Marshal marshals the dentryBatch into a byte array.

type DentryMultiSnap added in v1.34.0

type DentryMultiSnap struct {
	VerSeq uint64
	// contains filtered or unexported fields
}

func NewDentrySnap added in v1.34.0

func NewDentrySnap(seq uint64) *DentryMultiSnap

type DentryResponse

type DentryResponse struct {
	Status uint8
	Msg    *Dentry
}

func NewDentryResponse

func NewDentryResponse() *DentryResponse

type EvictInodeReq

type EvictInodeReq = proto.EvictInodeRequest

Client -> MetaNode

type Extend added in v1.5.0

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

func NewExtend added in v1.5.0

func NewExtend(inode uint64) *Extend

func NewExtendFromBytes added in v1.5.0

func NewExtendFromBytes(raw []byte) (*Extend, error)

func (*Extend) Bytes added in v1.5.0

func (e *Extend) Bytes() ([]byte, error)

func (*Extend) Copy added in v1.5.0

func (e *Extend) Copy() btree.Item

func (*Extend) Get added in v1.5.0

func (e *Extend) Get(key []byte) (value []byte, exist bool)

func (*Extend) GetExtentByVersion added in v1.34.0

func (e *Extend) GetExtentByVersion(ver uint64) (extend *Extend)

func (*Extend) GetInode added in v1.34.0

func (e *Extend) GetInode() (inode uint64)

func (*Extend) GetMinVer added in v1.34.0

func (e *Extend) GetMinVer() uint64

func (*Extend) Less added in v1.5.0

func (e *Extend) Less(than btree.Item) bool

func (*Extend) Merge added in v1.5.0

func (e *Extend) Merge(o *Extend, override bool)

func (*Extend) Put added in v1.5.0

func (e *Extend) Put(key, value []byte, verSeq uint64)

func (*Extend) Range added in v1.5.0

func (e *Extend) Range(visitor func(key, value []byte) bool)

func (*Extend) Remove added in v1.5.0

func (e *Extend) Remove(key []byte)

type ExtendOpResult added in v1.5.0

type ExtendOpResult struct {
	Status uint8
	Extend *Extend
}

type ExtentVal added in v1.34.0

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

type ExtentsTruncateReq

type ExtentsTruncateReq = proto.TruncateRequest

Client -> MetaNode

type FileSizeRange added in v1.34.0

type FileSizeRange uint32
const (
	LessThan1K FileSizeRange = iota
	LessThan1M
	LessThan16M
	LessThan32M
	LessThan64M
	LessThan128M
	LessThan256M
	BiggerThan256M
	MaxRangeType
)

type GetUniqIDResp added in v1.34.0

type GetUniqIDResp = proto.GetUniqIDResponse

Client -> MetaNode

type Inode

type Inode struct {
	sync.RWMutex
	Inode      uint64 // Inode ID
	Type       uint32
	Uid        uint32
	Gid        uint32
	Size       uint64
	Generation uint64
	CreateTime int64
	AccessTime int64
	ModifyTime int64
	LinkTarget []byte // SymLink target name
	NLink      uint32 // NodeLink counts
	Flag       int32
	Reserved   uint64 // reserved space
	// Extents    *ExtentsTree
	Extents    *SortedExtents
	ObjExtents *SortedObjExtents
	// contains filtered or unexported fields
}

func NewInode

func NewInode(ino uint64, t uint32) *Inode

NewInode returns a new Inode instance with specified Inode ID, name and type. The AccessTime and ModifyTime will be set to the current time.

func (*Inode) AppendExtentWithCheck added in v1.34.0

func (i *Inode) AppendExtentWithCheck(param *AppendExtParam) (delExtents []proto.ExtentKey, status uint8)

func (*Inode) AppendExtents

func (i *Inode) AppendExtents(eks []proto.ExtentKey, ct int64, volType int) (delExtents []proto.ExtentKey)

AppendExtents append the extent to the btree.

func (*Inode) AppendObjExtents added in v1.34.0

func (i *Inode) AppendObjExtents(eks []proto.ObjExtentKey, ct int64) (err error)

AppendObjExtents append the extent to the btree.

func (*Inode) Copy

func (i *Inode) Copy() BtreeItem

Copy returns a copy of the inode.

func (*Inode) CopyDirectly added in v1.34.0

func (i *Inode) CopyDirectly() BtreeItem

func (*Inode) CopyInodeOnly added in v1.34.0

func (i *Inode) CopyInodeOnly(cInode *Inode) *Inode

func (*Inode) CopyTinyExtents added in v1.34.0

func (i *Inode) CopyTinyExtents() (delExtents []proto.ExtentKey)

EmptyExtents clean the inode's extent list.

func (*Inode) CreateLowerVersion added in v1.34.0

func (i *Inode) CreateLowerVersion(curVer uint64, verlist *proto.VolVersionInfoList) (err error)

try to create version between curVer and seq of multiSnap.multiVersions[0] in verList

func (*Inode) CreateUnlinkVer added in v1.34.0

func (i *Inode) CreateUnlinkVer(mpVer uint64, nVer uint64)

func (*Inode) CreateVer added in v1.34.0

func (i *Inode) CreateVer(ver uint64)
func (i *Inode) DecNLink()

DecNLink decreases the nLink value by one.

func (*Inode) DecNLinkByVer added in v1.34.0

func (i *Inode) DecNLinkByVer(verSeq uint64)

DecNLink decreases the nLink value by one.

func (*Inode) DecSplitEk added in v1.34.0

func (i *Inode) DecSplitEk(mpId uint64, ext *proto.ExtentKey) (ok bool, last bool)

func (*Inode) DecSplitExts added in v1.34.0

func (i *Inode) DecSplitExts(mpId uint64, delExtents interface{})

func (*Inode) DoReadFunc

func (i *Inode) DoReadFunc(fn func())

DoFunc executes the given function.

func (*Inode) DoWriteFunc

func (i *Inode) DoWriteFunc(fn func())

func (*Inode) EmptyExtents added in v1.34.0

func (i *Inode) EmptyExtents(mtime int64) (delExtents []proto.ExtentKey)

EmptyExtents clean the inode's extent list.

func (*Inode) ExtentsTruncate

func (i *Inode) ExtentsTruncate(length uint64, ct int64, doOnLastKey func(*proto.ExtentKey), insertRefMap func(ek *proto.ExtentKey)) (delExtents []proto.ExtentKey)

func (*Inode) GetAllExtsOfflineInode added in v1.34.0

func (inode *Inode) GetAllExtsOfflineInode(mpID uint64) (extInfo map[uint64][]*proto.ExtentKey)

freelist clean inode get all exist extents info, deal special case for split key

func (*Inode) GetDecNLinkResult added in v1.34.0

func (i *Inode) GetDecNLinkResult() (nLink uint32)

DecNLink decreases the nLink value by one.

func (*Inode) GetMultiVerString added in v1.34.0

func (i *Inode) GetMultiVerString() string
func (i *Inode) GetNLink() uint32

GetNLink returns the nLink value.

func (*Inode) GetSpaceSize added in v1.34.0

func (i *Inode) GetSpaceSize() (extSize uint64)
func (i *Inode) IncNLink(verSeq uint64)

IncNLink increases the nLink value by one.

func (*Inode) IsEmptyDir

func (i *Inode) IsEmptyDir() bool

func (*Inode) IsEmptyDirAndNoSnapshot added in v1.34.0

func (i *Inode) IsEmptyDirAndNoSnapshot() bool

func (*Inode) IsTempFile

func (i *Inode) IsTempFile() bool

func (*Inode) IsTopLayerEmptyDir added in v1.34.0

func (i *Inode) IsTopLayerEmptyDir() bool

func (*Inode) Less

func (i *Inode) Less(than BtreeItem) bool

Less tests whether the current Inode item is less than the given one. This method is necessary fot B-Tree item implementation.

func (*Inode) Marshal

func (i *Inode) Marshal() (result []byte, err error)

Marshal marshals the inode into a byte array.

func (*Inode) MarshalInodeValue added in v1.34.0

func (i *Inode) MarshalInodeValue(buff *bytes.Buffer)

MarshalValue marshals the value to bytes.

func (*Inode) MarshalKey

func (i *Inode) MarshalKey() (k []byte)

MarshalKey marshals the exporterKey to bytes.

func (*Inode) MarshalToJSON

func (i *Inode) MarshalToJSON() ([]byte, error)

MarshalToJSON is the wrapper of json.Marshal.

func (*Inode) MarshalValue

func (i *Inode) MarshalValue() (val []byte)

MarshalValue marshals the value to bytes.

func (*Inode) MultiLayerClearExtByVer added in v1.34.0

func (i *Inode) MultiLayerClearExtByVer(layer int, dVerSeq uint64) (delExtents []proto.ExtentKey)

clear snapshot extkey with releated verSeq

func (*Inode) PrintAllVersionInfo added in v1.34.0

func (i *Inode) PrintAllVersionInfo()

func (*Inode) RangeMultiVer added in v1.34.0

func (i *Inode) RangeMultiVer(visitor func(idx int, info *Inode) bool)

func (*Inode) RestoreExts2NextLayer added in v1.34.0

func (i *Inode) RestoreExts2NextLayer(mpId uint64, delExtentsOrigin []proto.ExtentKey, curVer uint64, idx int) (delExtents []proto.ExtentKey, err error)

Restore ext info to older version or deleted if no right version The list(multiSnap.multiVersions) contains all point of modification on inode, each ext must belong to one layer. Once the layer be deleted is top layer ver be changed to upper layer, or else the ext belongs is exclusive and can be dropped

func (*Inode) SetAttr

func (i *Inode) SetAttr(req *SetattrRequest)

SetAttr sets the attributes of the inode.

func (*Inode) SetDeleteMark

func (i *Inode) SetDeleteMark()

SetDeleteMark set the deleteMark flag. TODO markDelete or deleteMark? markDelete has been used in datanode.

func (*Inode) SetMtime added in v1.34.0

func (i *Inode) SetMtime()

SetMtime sets mtime to the current time.

func (*Inode) ShouldDelVer added in v1.34.0

func (i *Inode) ShouldDelVer(delVer uint64, mpVer uint64) (ok bool, err error)

func (*Inode) ShouldDelayDelete added in v1.34.0

func (i *Inode) ShouldDelayDelete() (ok bool)

inode should delay remove if as 3 conditions: 1. DeleteMarkFlag is unset 2. NLink == 0 3. AccessTime is 7 days ago

func (*Inode) ShouldDelete

func (i *Inode) ShouldDelete() (ok bool)

ShouldDelete returns if the inode has been marked as deleted.

func (*Inode) SplitExtentWithCheck added in v1.34.0

func (i *Inode) SplitExtentWithCheck(param *AppendExtParam) (delExtents []proto.ExtentKey, status uint8)

func (*Inode) String

func (i *Inode) String() string

String returns the string format of the inode.

func (*Inode) Unmarshal

func (i *Inode) Unmarshal(raw []byte) (err error)

Unmarshal unmarshals the inode.

func (*Inode) UnmarshalInodeValue added in v1.34.0

func (i *Inode) UnmarshalInodeValue(buff *bytes.Buffer) (err error)

UnmarshalValue unmarshals the value from bytes.

func (*Inode) UnmarshalKey

func (i *Inode) UnmarshalKey(k []byte) (err error)

UnmarshalKey unmarshals the exporterKey from bytes.

func (*Inode) UnmarshalValue

func (i *Inode) UnmarshalValue(val []byte) (err error)

UnmarshalValue unmarshals the value from bytes.

type InodeBatch added in v1.34.0

type InodeBatch []*Inode

func InodeBatchUnmarshal added in v1.34.0

func InodeBatchUnmarshal(raw []byte) (InodeBatch, error)

Unmarshal unmarshals the inodeBatch.

func (*InodeBatch) Clone added in v1.34.0

func (i *InodeBatch) Clone() InodeBatch

func (InodeBatch) Marshal added in v1.34.0

func (i InodeBatch) Marshal() ([]byte, error)

Marshal marshals the inodeBatch into a byte array.

type InodeGetReq

type InodeGetReq = proto.InodeGetRequest

Client -> MetaNode

type InodeGetReqBatch

type InodeGetReqBatch = proto.BatchInodeGetRequest

Client -> MetaNode

type InodeGetSplitReq added in v1.34.0

type InodeGetSplitReq = proto.InodeGetSplitRequest

Tool -> MetaNode

type InodeMultiSnap added in v1.34.0

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

func NewMultiSnap added in v1.34.0

func NewMultiSnap(seq uint64) *InodeMultiSnap

type InodeOnce added in v1.34.0

type InodeOnce struct {
	UniqID uint64
	Inode  uint64 // Inode ID
	VerSeq uint64
}

func InodeOnceUnmarshal added in v1.34.0

func InodeOnceUnmarshal(val []byte) (i *InodeOnce, err error)

func (*InodeOnce) Marshal added in v1.34.0

func (i *InodeOnce) Marshal() (val []byte)

type InodeResponse

type InodeResponse struct {
	Status uint8
	Msg    *Inode
}

func NewInodeResponse

func NewInodeResponse() *InodeResponse

type LinkInodeReq

type LinkInodeReq = proto.LinkInodeRequest

Client -> MetaNode create Link Request

type LinkInodeResp

type LinkInodeResp = proto.LinkInodeResponse

MetaNode -> Client create Link Response

type LookupReq

type LookupReq = proto.LookupRequest

MetaNode -> Client lookup

type LookupResp

type LookupResp = proto.LookupResponse

Client -> MetaNode lookup

type MetaItem

type MetaItem struct {
	Op uint32 `json:"Op"`
	K  []byte `json:"k"`
	V  []byte `json:"v"`
}

MetaItem defines the structure of the metadata operations.

func NewMetaItem

func NewMetaItem(op uint32, key, value []byte) *MetaItem

NewMetaItem returns a new MetaItem.

func (*MetaItem) MarshalBinary

func (s *MetaItem) MarshalBinary() (result []byte, err error)

MarshalBinary marshals MetaItem to binary data. Binary frame structure:

+------+----+------+------+------+------+
| Item | Op | LenK |   K  | LenV |   V  |
+------+----+------+------+------+------+
| byte | 4  |  4   | LenK |  4   | LenV |
+------+----+------+------+------+------+

func (*MetaItem) MarshalJson

func (s *MetaItem) MarshalJson() ([]byte, error)

MarshalJson

func (*MetaItem) UnmarshalBinary

func (s *MetaItem) UnmarshalBinary(raw []byte) (err error)

MarshalBinary unmarshal this MetaItem entity from binary data. Binary frame structure:

+------+----+------+------+------+------+
| Item | Op | LenK |   K  | LenV |   V  |
+------+----+------+------+------+------+
| byte | 4  |  4   | LenK |  4   | LenV |
+------+----+------+------+------+------+

func (*MetaItem) UnmarshalJson

func (s *MetaItem) UnmarshalJson(data []byte) error

UnmarshalJson unmarshals binary data to MetaItem.

type MetaItemIterator

type MetaItemIterator struct {
	SnapFormatVersion uint32
	// contains filtered or unexported fields
}

MetaItemIterator defines the iterator of the MetaItem.

func (*MetaItemIterator) ApplyIndex

func (si *MetaItemIterator) ApplyIndex() uint64

ApplyIndex returns the applyID of the iterator.

func (*MetaItemIterator) Close

func (si *MetaItemIterator) Close()

Close closes the iterator.

func (*MetaItemIterator) Next

func (si *MetaItemIterator) Next() (data []byte, err error)

Next returns the next item.

type MetaMultiSnapshotInfo added in v1.34.0

type MetaMultiSnapshotInfo struct {
	VerSeq uint64
	Status int8
	Ctime  time.Time
}

MetaMultiSnapshotInfo

type MetaNode

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

The MetaNode manages the dentry and inode information of the meta partitions on a meta node. The data consistency is ensured by Raft.

func NewServer

func NewServer() *MetaNode

NewServer creates a new meta node instance.

func (*MetaNode) AddConnection added in v1.34.0

func (m *MetaNode) AddConnection()

AddConnection adds a connection.

func (*MetaNode) RemoveConnection added in v1.34.0

func (m *MetaNode) RemoveConnection()

RemoveConnection removes a connection.

func (*MetaNode) Shutdown

func (m *MetaNode) Shutdown()

Shutdown stops the meta node.

func (*MetaNode) Start

func (m *MetaNode) Start(cfg *config.Config) (err error)

Start starts up the meta node with the specified configuration.

  1. Start and load each meta partition from the snapshot.
  2. Restore raftStore fsm of each meta node range.
  3. Start server and accept connection from the master and clients.

func (*MetaNode) Sync

func (m *MetaNode) Sync()

Sync blocks the invoker's goroutine until the meta node shuts down.

type MetaNodeMetrics added in v1.34.0

type MetaNodeMetrics struct {
	MetricConnectionCount          *exporter.Gauge
	MetricMetaFailedPartition      *exporter.Gauge
	MetricMetaPartitionInodeCount  *exporter.Gauge
	MetricMetaPartitionDentryCount *exporter.Gauge
	// contains filtered or unexported fields
}

type MetaPartition

type MetaPartition interface {
	Start(isCreate bool) error
	Stop()
	DataSize() uint64
	GetFreeListLen() int
	OpMeta
	LoadSnapshot(path string) error
	ForceSetMetaPartitionToLoadding()
	ForceSetMetaPartitionToFininshLoad()
	IsForbidden() bool
	SetForbidden(status bool)
	IsEnableAuditLog() bool
	SetEnableAuditLog(status bool)
	UpdateVolumeView(dataView *proto.DataPartitionsView, volumeView *proto.SimpleVolView)
}

MetaPartition defines the interface for the meta partition operations.

func NewMetaPartition

func NewMetaPartition(conf *MetaPartitionConfig, manager *metadataManager) MetaPartition

NewMetaPartition creates a new meta partition with the specified configuration.

type MetaPartitionConfig

type MetaPartitionConfig struct {
	// Identity for raftStore group. RaftStore nodes in the same raftStore group must have the same groupID.
	PartitionId   uint64              `json:"partition_id"`
	VolName       string              `json:"vol_name"`
	Start         uint64              `json:"start"` // Minimal Inode ID of this range. (Required during initialization)
	End           uint64              `json:"end"`   // Maximal Inode ID of this range. (Required during initialization)
	PartitionType int                 `json:"partition_type"`
	Peers         []proto.Peer        `json:"peers"` // Peers information of the raftStore
	Cursor        uint64              `json:"-"`     // Cursor ID of the inode that have been assigned
	UniqId        uint64              `json:"-"`
	NodeId        uint64              `json:"-"`
	RootDir       string              `json:"-"`
	VerSeq        uint64              `json:"ver_seq"`
	BeforeStart   func()              `json:"-"`
	AfterStart    func()              `json:"-"`
	BeforeStop    func()              `json:"-"`
	AfterStop     func()              `json:"-"`
	RaftStore     raftstore.RaftStore `json:"-"`
	ConnPool      *util.ConnectPool   `json:"-"`
	Forbidden     bool                `json:"-"`
}

MetaPartitionConfig is used to create a meta partition.

type MetaQuotaInode added in v1.34.0

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

func (*MetaQuotaInode) Marshal added in v1.34.0

func (qInode *MetaQuotaInode) Marshal() (result []byte, err error)

func (*MetaQuotaInode) Unmarshal added in v1.34.0

func (qInode *MetaQuotaInode) Unmarshal(raw []byte) (err error)

type MetaQuotaManager added in v1.34.0

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

func NewQuotaManager added in v1.34.0

func NewQuotaManager(volName string, mpId uint64) (mqMgr *MetaQuotaManager)

func (*MetaQuotaManager) EnableQuota added in v1.34.0

func (mqMgr *MetaQuotaManager) EnableQuota() bool

func (*MetaQuotaManager) IsOverQuota added in v1.34.0

func (mqMgr *MetaQuotaManager) IsOverQuota(size bool, files bool, quotaId uint32) (status uint8)

type MetadataManager

type MetadataManager interface {
	Start() error
	Stop()
	// CreatePartition(id string, start, end uint64, peers []proto.Peer) error
	HandleMetadataOperation(conn net.Conn, p *Packet, remoteAddr string) error
	GetPartition(id uint64) (MetaPartition, error)
	GetLeaderPartitions() map[uint64]MetaPartition
	GetAllVolumes() (volumes *util.Set)
	// contains filtered or unexported methods
}

MetadataManager manages all the meta partitions.

func NewMetadataManager

func NewMetadataManager(conf MetadataManagerConfig, metaNode *MetaNode) MetadataManager

NewMetadataManager returns a new metadata manager.

type MetadataManagerConfig

type MetadataManagerConfig struct {
	NodeID        uint64
	RootDir       string
	ZoneName      string
	EnableGcTimer bool
	RaftStore     raftstore.RaftStore
}

MetadataManagerConfig defines the configures in the metadata manager.

type Multipart added in v1.5.0

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

Multipart defined necessary fields for multipart session management.

func MultipartFromBytes added in v1.5.0

func MultipartFromBytes(raw []byte) *Multipart

func (*Multipart) Bytes added in v1.5.0

func (m *Multipart) Bytes() ([]byte, error)

func (*Multipart) Copy added in v1.5.0

func (m *Multipart) Copy() btree.Item

func (*Multipart) ID added in v1.5.0

func (m *Multipart) ID() string

func (*Multipart) InsertPart added in v1.5.0

func (m *Multipart) InsertPart(part *Part, replace bool) (success bool)

Deprecated

func (*Multipart) Less added in v1.5.0

func (m *Multipart) Less(than btree.Item) bool

func (*Multipart) Parts added in v1.5.0

func (m *Multipart) Parts() []*Part

func (*Multipart) UpdateOrStorePart added in v1.34.0

func (m *Multipart) UpdateOrStorePart(part *Part) (oldInode uint64, updated, conflict bool)

type MultipartExtend added in v1.34.0

type MultipartExtend map[string]string

func MultipartExtendFromBytes added in v1.34.0

func MultipartExtendFromBytes(raw []byte) MultipartExtend

func NewMultipartExtend added in v1.34.0

func NewMultipartExtend() MultipartExtend

func (MultipartExtend) Bytes added in v1.34.0

func (me MultipartExtend) Bytes() ([]byte, error)

type NodeInfo added in v1.34.0

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

type OpDentry

type OpDentry interface {
	CreateDentry(req *CreateDentryReq, p *Packet, remoteAddr string) (err error)
	DeleteDentry(req *DeleteDentryReq, p *Packet, remoteAddr string) (err error)
	DeleteDentryBatch(req *BatchDeleteDentryReq, p *Packet, remoteAddr string) (err error)
	UpdateDentry(req *UpdateDentryReq, p *Packet, remoteAddr string) (err error)
	ReadDir(req *ReadDirReq, p *Packet) (err error)
	ReadDirLimit(req *ReadDirLimitReq, p *Packet) (err error)
	ReadDirOnly(req *ReadDirOnlyReq, p *Packet) (err error)
	Lookup(req *LookupReq, p *Packet) (err error)
	GetDentryTree() *BTree
	GetDentryTreeLen() int
	TxCreateDentry(req *proto.TxCreateDentryRequest, p *Packet, remoteAddr string) (err error)
	TxDeleteDentry(req *proto.TxDeleteDentryRequest, p *Packet, remoteAddr string) (err error)
	TxUpdateDentry(req *proto.TxUpdateDentryRequest, p *Packet, remoteAddr string) (err error)
	QuotaCreateDentry(req *proto.QuotaCreateDentryRequest, p *Packet, remoteAddr string) (err error)
}

OpDentry defines the interface for the dentry operations.

type OpExtend added in v1.5.0

type OpExtend interface {
	SetXAttr(req *proto.SetXAttrRequest, p *Packet) (err error)
	BatchSetXAttr(req *proto.BatchSetXAttrRequest, p *Packet) (err error)
	GetXAttr(req *proto.GetXAttrRequest, p *Packet) (err error)
	GetAllXAttr(req *proto.GetAllXAttrRequest, p *Packet) (err error)
	BatchGetXAttr(req *proto.BatchGetXAttrRequest, p *Packet) (err error)
	RemoveXAttr(req *proto.RemoveXAttrRequest, p *Packet) (err error)
	ListXAttr(req *proto.ListXAttrRequest, p *Packet) (err error)
	UpdateXAttr(req *proto.UpdateXAttrRequest, p *Packet) (err error)
	LockDir(req *proto.LockDirRequest, p *Packet) (err error)
}

type OpExtent

type OpExtent interface {
	ExtentAppend(req *proto.AppendExtentKeyRequest, p *Packet) (err error)
	ExtentAppendWithCheck(req *proto.AppendExtentKeyWithCheckRequest, p *Packet) (err error)
	BatchObjExtentAppend(req *proto.AppendObjExtentKeysRequest, p *Packet) (err error)
	ExtentsList(req *proto.GetExtentsRequest, p *Packet) (err error)
	ObjExtentsList(req *proto.GetExtentsRequest, p *Packet) (err error)
	ExtentsTruncate(req *ExtentsTruncateReq, p *Packet, remoteAddr string) (err error)
	BatchExtentAppend(req *proto.AppendExtentKeysRequest, p *Packet) (err error)
}

OpExtent defines the interface for the extent operations.

type OpInode

type OpInode interface {
	CreateInode(req *CreateInoReq, p *Packet, remoteAddr string) (err error)
	UnlinkInode(req *UnlinkInoReq, p *Packet, remoteAddr string) (err error)
	UnlinkInodeBatch(req *BatchUnlinkInoReq, p *Packet, remoteAddr string) (err error)
	InodeGet(req *InodeGetReq, p *Packet) (err error)
	InodeGetSplitEk(req *InodeGetSplitReq, p *Packet) (err error)
	InodeGetBatch(req *InodeGetReqBatch, p *Packet) (err error)
	CreateInodeLink(req *LinkInodeReq, p *Packet, remoteAddr string) (err error)
	EvictInode(req *EvictInodeReq, p *Packet, remoteAddr string) (err error)
	EvictInodeBatch(req *BatchEvictInodeReq, p *Packet, remoteAddr string) (err error)
	SetAttr(req *SetattrRequest, reqData []byte, p *Packet) (err error)
	GetInodeTree() *BTree
	GetInodeTreeLen() int
	DeleteInode(req *proto.DeleteInodeRequest, p *Packet, remoteAddr string) (err error)
	DeleteInodeBatch(req *proto.DeleteInodeBatchRequest, p *Packet, remoteAddr string) (err error)
	ClearInodeCache(req *proto.ClearInodeCacheRequest, p *Packet) (err error)
	TxCreateInode(req *proto.TxCreateInodeRequest, p *Packet, remoteAddr string) (err error)
	TxUnlinkInode(req *proto.TxUnlinkInodeRequest, p *Packet, remoteAddr string) (err error)
	TxCreateInodeLink(req *proto.TxLinkInodeRequest, p *Packet, remoteAddr string) (err error)
	QuotaCreateInode(req *proto.QuotaCreateInodeRequest, p *Packet, remoteAddr string) (err error)
	InodeGetAccessTime(req *InodeGetReq, p *Packet) (err error)
}

OpInode defines the interface for the inode operations.

type OpMeta

OpMeta defines the interface for the metadata operations.

type OpMultiVersion added in v1.34.0

type OpMultiVersion interface {
	GetVerSeq() uint64
	GetVerList() []*proto.VolVersionInfo
	GetAllVerList() []*proto.VolVersionInfo
	HandleVersionOp(op uint8, verSeq uint64, verList []*proto.VolVersionInfo, sync bool) (err error)

	GetAllVersionInfo(req *proto.MultiVersionOpRequest, p *Packet) (err error)
	GetSpecVersionInfo(req *proto.MultiVersionOpRequest, p *Packet) (err error)
	GetExtentByVer(ino *Inode, req *proto.GetExtentsRequest, rsp *proto.GetExtentsResponse)
	// contains filtered or unexported methods
}

MultiVersion operation from master or client

type OpMultipart added in v1.5.0

type OpMultipart interface {
	GetMultipart(req *proto.GetMultipartRequest, p *Packet) (err error)
	CreateMultipart(req *proto.CreateMultipartRequest, p *Packet) (err error)
	AppendMultipart(req *proto.AddMultipartPartRequest, p *Packet) (err error)
	RemoveMultipart(req *proto.RemoveMultipartRequest, p *Packet) (err error)
	ListMultipart(req *proto.ListMultipartRequest, p *Packet) (err error)
	GetUidInfo() (info []*proto.UidReportSpaceInfo)
	SetUidLimit(info []*proto.UidSpaceInfo)
	SetTxInfo(info []*proto.TxInfo)
	GetExpiredMultipart(req *proto.GetExpiredMultipartRequest, p *Packet) (err error)
}

type OpPartition

type OpPartition interface {
	GetVolName() (volName string)
	IsLeader() (leaderAddr string, isLeader bool)
	LeaderTerm() (leaderID, term uint64)
	IsFollowerRead() bool
	SetFollowerRead(bool)
	GetCursor() uint64
	GetUniqId() uint64
	GetBaseConfig() MetaPartitionConfig
	ResponseLoadMetaPartition(p *Packet) (err error)
	PersistMetadata() (err error)
	RenameStaleMetadata() (err error)
	ChangeMember(changeType raftproto.ConfChangeType, peer raftproto.Peer, context []byte) (resp interface{}, err error)
	Reset() (err error)
	UpdatePartition(req *UpdatePartitionReq, resp *UpdatePartitionResp) (err error)
	DeleteRaft() error
	IsExsitPeer(peer proto.Peer) bool
	TryToLeader(groupID uint64) error
	CanRemoveRaftMember(peer proto.Peer) error
	IsEquareCreateMetaPartitionRequst(request *proto.CreateMetaPartitionRequest) (err error)
	GetUniqID(p *Packet, num uint32) (err error)
}

OpPartition defines the interface for the partition operations.

type OpQuota added in v1.34.0

type OpQuota interface {
	// contains filtered or unexported methods
}

type OpTransaction added in v1.34.0

type OpTransaction interface {
	TxCreate(req *proto.TxCreateRequest, p *Packet) (err error)
	TxCommitRM(req *proto.TxApplyRMRequest, p *Packet) error
	TxRollbackRM(req *proto.TxApplyRMRequest, p *Packet) error
	TxCommit(req *proto.TxApplyRequest, p *Packet, remoteAddr string) (err error)
	TxRollback(req *proto.TxApplyRequest, p *Packet, remoteAddr string) (err error)
	TxGetInfo(req *proto.TxGetInfoRequest, p *Packet) (err error)
	TxGetCnt() (uint64, uint64, uint64)
	TxGetTree() (*BTree, *BTree, *BTree)
}

type Packet

type Packet struct {
	proto.Packet
}

func NewPacketToBatchDeleteExtent added in v1.34.0

func NewPacketToBatchDeleteExtent(dp *DataPartition, exts []*proto.DelExtentParam) *Packet

NewPacketToBatchDeleteExtent returns a new packet to batch delete the extent.

func NewPacketToDeleteExtent

func NewPacketToDeleteExtent(dp *DataPartition, ext *proto.ExtentKey) (p *Packet, invalid bool)

NewPacketToDeleteExtent returns a new packet to delete the extent.

func NewPacketToFreeInodeOnRaftFollower

func NewPacketToFreeInodeOnRaftFollower(partitionID uint64, freeInodes []byte) *Packet

NewPacketToDeleteExtent returns a new packet to delete the extent.

type Part added in v1.5.0

type Part struct {
	ID         uint16
	UploadTime time.Time
	MD5        string
	Size       uint64
	Inode      uint64
}

Part defined necessary fields for multipart part management.

func PartFromBytes added in v1.5.0

func PartFromBytes(raw []byte) *Part

func (Part) Bytes added in v1.5.0

func (m Part) Bytes() ([]byte, error)

func (*Part) Equal added in v1.34.0

func (m *Part) Equal(o *Part) bool

type Parts added in v1.5.0

type Parts []*Part

func PartsFromBytes added in v1.5.0

func PartsFromBytes(raw []byte) Parts

func (Parts) Bytes added in v1.5.0

func (m Parts) Bytes() ([]byte, error)

func (*Parts) Hash added in v1.5.0

func (m *Parts) Hash(part *Part) (has bool)

func (*Parts) Insert added in v1.5.0

func (m *Parts) Insert(part *Part, replace bool) (success bool)

Deprecated

func (Parts) Len added in v1.5.0

func (m Parts) Len() int

func (*Parts) Remove added in v1.5.0

func (m *Parts) Remove(id uint16)

func (Parts) Search added in v1.5.0

func (m Parts) Search(id uint16) (part *Part, found bool)

func (*Parts) UpdateOrStore added in v1.34.0

func (m *Parts) UpdateOrStore(part *Part) (oldInode uint64, update, conflict bool)

type ReadDirLimitReq added in v1.34.0

type ReadDirLimitReq = proto.ReadDirLimitRequest

Type alias.

type ReadDirLimitResp added in v1.34.0

type ReadDirLimitResp = proto.ReadDirLimitResponse

Type alias.

type ReadDirOnlyReq added in v1.34.0

type ReadDirOnlyReq = proto.ReadDirOnlyRequest

Type alias.

type ReadDirOnlyResp added in v1.34.0

type ReadDirOnlyResp = proto.ReadDirOnlyResponse

Type alias.

type ReadDirReq

type ReadDirReq = proto.ReadDirRequest

Client -> MetaNode read dir request

type ReadDirResp

type ReadDirResp = proto.ReadDirResponse

MetaNode -> Client read dir response

type SetattrRequest

type SetattrRequest = proto.SetAttrRequest

Client -> MetaNode

type SnapItemWrapper added in v1.34.0

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

func (*SnapItemWrapper) MarshalKey added in v1.34.0

func (siw *SnapItemWrapper) MarshalKey() (k []byte)

func (*SnapItemWrapper) UnmarshalKey added in v1.34.0

func (siw *SnapItemWrapper) UnmarshalKey(k []byte) (err error)

type SortedExtents added in v1.34.0

type SortedExtents struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSortedExtents added in v1.34.0

func NewSortedExtents() *SortedExtents

func NewSortedExtentsFromEks added in v1.34.0

func NewSortedExtentsFromEks(eks []proto.ExtentKey) *SortedExtents

attention: only used for deleted eks

func (*SortedExtents) Append added in v1.34.0

func (se *SortedExtents) Append(ek proto.ExtentKey) (deleteExtents []proto.ExtentKey)

func (*SortedExtents) AppendWithCheck added in v1.34.0

func (se *SortedExtents) AppendWithCheck(inodeID uint64, ek proto.ExtentKey, addRefFunc func(*proto.ExtentKey), clientDiscardExts []proto.ExtentKey) (deleteExtents []proto.ExtentKey, status uint8)

func (*SortedExtents) CheckAndAddRef added in v1.34.0

func (se *SortedExtents) CheckAndAddRef(lastKey *proto.ExtentKey, currEk *proto.ExtentKey, addRefFunc func(*proto.ExtentKey)) (ok bool)

func (*SortedExtents) Clone added in v1.34.0

func (se *SortedExtents) Clone() *SortedExtents

func (*SortedExtents) CopyExtents added in v1.34.0

func (se *SortedExtents) CopyExtents() []proto.ExtentKey

func (*SortedExtents) CopyTinyExtents added in v1.34.0

func (se *SortedExtents) CopyTinyExtents() []proto.ExtentKey

func (*SortedExtents) Delete added in v1.34.0

func (se *SortedExtents) Delete(delEks []proto.ExtentKey) (curEks []proto.ExtentKey)

discard code

func (*SortedExtents) LayerSize added in v1.34.0

func (se *SortedExtents) LayerSize() (layerSize uint64)

Returns the file size

func (*SortedExtents) Len added in v1.34.0

func (se *SortedExtents) Len() int

func (*SortedExtents) MarshalBinary added in v1.34.0

func (se *SortedExtents) MarshalBinary(v3 bool) ([]byte, error)

func (*SortedExtents) Range added in v1.34.0

func (se *SortedExtents) Range(f func(index int, ek proto.ExtentKey) bool)

func (*SortedExtents) Size added in v1.34.0

func (se *SortedExtents) Size() uint64

Returns the file size

func (*SortedExtents) SplitWithCheck added in v1.34.0

func (se *SortedExtents) SplitWithCheck(mpId uint64, inodeID uint64, ekSplit proto.ExtentKey, ekRef *sync.Map) (delExtents []proto.ExtentKey, status uint8)

func (*SortedExtents) String added in v1.34.0

func (se *SortedExtents) String() string

func (*SortedExtents) Truncate added in v1.34.0

func (se *SortedExtents) Truncate(offset uint64, doOnLastKey func(*proto.ExtentKey), insertRefMap func(ek *proto.ExtentKey)) (deleteExtents []proto.ExtentKey)

func (*SortedExtents) UnmarshalBinary added in v1.34.0

func (se *SortedExtents) UnmarshalBinary(data []byte, v3 bool) (err error, splitMap *sync.Map)

type SortedObjExtents added in v1.34.0

type SortedObjExtents struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSortedObjExtents added in v1.34.0

func NewSortedObjExtents() *SortedObjExtents

func (*SortedObjExtents) Append added in v1.34.0

func (se *SortedObjExtents) Append(ek proto.ObjExtentKey) (err error)

Append will return error if the objextentkey exist overlap.

func (*SortedObjExtents) Clone added in v1.34.0

func (se *SortedObjExtents) Clone() *SortedObjExtents

func (*SortedObjExtents) CopyExtents added in v1.34.0

func (se *SortedObjExtents) CopyExtents() []proto.ObjExtentKey

func (*SortedObjExtents) FindOffsetExist added in v1.34.0

func (se *SortedObjExtents) FindOffsetExist(fileOffset uint64) (bool, int)

func (*SortedObjExtents) MarshalBinary added in v1.34.0

func (se *SortedObjExtents) MarshalBinary() ([]byte, error)

func (*SortedObjExtents) Range added in v1.34.0

func (se *SortedObjExtents) Range(f func(ek proto.ObjExtentKey) bool)

func (*SortedObjExtents) Size added in v1.34.0

func (se *SortedObjExtents) Size() uint64

Returns the file size

func (*SortedObjExtents) String added in v1.34.0

func (se *SortedObjExtents) String() string

func (*SortedObjExtents) UnmarshalBinary added in v1.34.0

func (se *SortedObjExtents) UnmarshalBinary(data []byte) error

type TransactionManager added in v1.34.0

type TransactionManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

TM

func NewTransactionManager added in v1.34.0

func NewTransactionManager(txProcessor *TransactionProcessor) *TransactionManager

func (*TransactionManager) Reset added in v1.34.0

func (tm *TransactionManager) Reset()

type TransactionProcessor added in v1.34.0

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

func NewTransactionProcessor added in v1.34.0

func NewTransactionProcessor(mp *metaPartition) *TransactionProcessor

func (*TransactionProcessor) Pause added in v1.34.0

func (p *TransactionProcessor) Pause() bool

func (*TransactionProcessor) Reset added in v1.34.0

func (p *TransactionProcessor) Reset()

type TransactionResource added in v1.34.0

type TransactionResource struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

RM

func NewTransactionResource added in v1.34.0

func NewTransactionResource(txProcessor *TransactionProcessor) *TransactionResource

func (*TransactionResource) Reset added in v1.34.0

func (tr *TransactionResource) Reset()

type TxDentry added in v1.34.0

type TxDentry struct {
	// ParInode *Inode
	Dentry *Dentry
	TxInfo *proto.TransactionInfo
}

func NewTxDentry added in v1.34.0

func NewTxDentry(parentID uint64, name string, ino uint64, mode uint32, parInode *Inode, txInfo *proto.TransactionInfo) *TxDentry

func (*TxDentry) Marshal added in v1.34.0

func (td *TxDentry) Marshal() (result []byte, err error)

func (*TxDentry) Unmarshal added in v1.34.0

func (td *TxDentry) Unmarshal(raw []byte) (err error)

type TxIDAllocator added in v1.34.0

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

TxIDAllocator generates and allocates ids

func (*TxIDAllocator) Reset added in v1.34.0

func (alloc *TxIDAllocator) Reset()

type TxInode added in v1.34.0

type TxInode struct {
	Inode  *Inode
	TxInfo *proto.TransactionInfo
}

func NewTxInode added in v1.34.0

func NewTxInode(ino uint64, t uint32, txInfo *proto.TransactionInfo) *TxInode

func (*TxInode) Marshal added in v1.34.0

func (ti *TxInode) Marshal() (result []byte, err error)

func (*TxInode) Unmarshal added in v1.34.0

func (ti *TxInode) Unmarshal(raw []byte) (err error)

type TxMetaQuotaInode added in v1.34.0

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

func (*TxMetaQuotaInode) Marshal added in v1.34.0

func (qInode *TxMetaQuotaInode) Marshal() (result []byte, err error)

func (*TxMetaQuotaInode) Unmarshal added in v1.34.0

func (qInode *TxMetaQuotaInode) Unmarshal(raw []byte) (err error)

type TxRollbackDentry added in v1.34.0

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

func NewTxRollbackDentry added in v1.34.0

func NewTxRollbackDentry(dentry *Dentry, txDentryInfo *proto.TxDentryInfo, rbType uint8) *TxRollbackDentry

func (*TxRollbackDentry) Copy added in v1.34.0

func (d *TxRollbackDentry) Copy() btree.Item

Copy returns a copy of the TxRollbackDentry.

func (*TxRollbackDentry) Less added in v1.34.0

func (d *TxRollbackDentry) Less(than btree.Item) bool

Less tests whether the current TxRollbackDentry item is less than the given one.

func (*TxRollbackDentry) Marshal added in v1.34.0

func (d *TxRollbackDentry) Marshal() (result []byte, err error)

func (*TxRollbackDentry) ToString added in v1.34.0

func (d *TxRollbackDentry) ToString() string

func (*TxRollbackDentry) Unmarshal added in v1.34.0

func (d *TxRollbackDentry) Unmarshal(raw []byte) (err error)

type TxRollbackInode added in v1.34.0

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

func NewTxRollbackInode added in v1.34.0

func NewTxRollbackInode(inode *Inode, quotaIds []uint32, txInodeInfo *proto.TxInodeInfo, rbType uint8) *TxRollbackInode

func (*TxRollbackInode) Copy added in v1.34.0

func (i *TxRollbackInode) Copy() btree.Item

Copy returns a copy of the TxRollbackInode.

func (*TxRollbackInode) Less added in v1.34.0

func (i *TxRollbackInode) Less(than btree.Item) bool

Less tests whether the current TxRollbackInode item is less than the given one.

func (*TxRollbackInode) Marshal added in v1.34.0

func (i *TxRollbackInode) Marshal() (result []byte, err error)

func (*TxRollbackInode) ToString added in v1.34.0

func (i *TxRollbackInode) ToString() string

func (*TxRollbackInode) Unmarshal added in v1.34.0

func (i *TxRollbackInode) Unmarshal(raw []byte) (err error)

type TxUpdateDentry added in v1.34.0

type TxUpdateDentry struct {
	OldDentry *Dentry
	NewDentry *Dentry
	TxInfo    *proto.TransactionInfo
}

func NewTxUpdateDentry added in v1.34.0

func NewTxUpdateDentry(oldDentry *Dentry, newDentry *Dentry, txInfo *proto.TransactionInfo) *TxUpdateDentry

func (*TxUpdateDentry) Marshal added in v1.34.0

func (td *TxUpdateDentry) Marshal() (result []byte, err error)

func (*TxUpdateDentry) Unmarshal added in v1.34.0

func (td *TxUpdateDentry) Unmarshal(raw []byte) (err error)

type UidManager added in v1.34.0

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

func NewUidMgr added in v1.34.0

func NewUidMgr(volName string, mpID uint64) (mgr *UidManager)

type UniqIdResp added in v1.34.0

type UniqIdResp struct {
	Start  uint64
	End    uint64
	Status uint8
}

type UnlinkInoReq

type UnlinkInoReq = proto.UnlinkInodeRequest

Client -> MetaNode delete Inode request struct

type UnlinkInoResp

type UnlinkInoResp = proto.UnlinkInodeResponse

MetaNode -> Client delete Inode response

type UpdateDentryReq

type UpdateDentryReq = proto.UpdateDentryRequest

Client -> MetaNode updateDentry request

type UpdateDentryResp

type UpdateDentryResp = proto.UpdateDentryResponse

MetaNode -> Client updateDentry response

type UpdatePartitionReq

type UpdatePartitionReq = proto.UpdateMetaPartitionRequest

Master -> MetaNode

type UpdatePartitionResp

type UpdatePartitionResp = proto.UpdateMetaPartitionResponse

MetaNode -> Master

type VerOpData added in v1.34.0

type VerOpData struct {
	Op      uint8
	VerSeq  uint64
	VerList []*proto.VolVersionInfo
}

type Vol

type Vol struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Vol defines the view of the data partition with the read/write lock.

func NewVol

func NewVol() *Vol

NewVol returns a new volume instance.

func (*Vol) GetPartition

func (v *Vol) GetPartition(partitionID uint64) *DataPartition

GetPartition returns the data partition based on the given partition ID.

func (*Vol) UpdatePartitions

func (v *Vol) UpdatePartitions(partitions *DataPartitionsView)

UpdatePartitions updates the data partition.

Jump to

Keyboard shortcuts

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