Documentation ¶
Overview ¶
Package inode provides inode-management functionality for ProxyFS.
Index ¶
- Constants
- func AccountNameToVolumeName(accountName string) (volumeName string, ok bool)
- func SetRWMode(rwMode RWModeType) (err error)
- func VolumeNameToAccountName(volumeName string) (accountName string, ok bool)
- func VolumeNameToActivePeerPrivateIPAddr(volumeName string) (activePeerPrivateIPAddr string, ok bool)
- type AccessOverride
- type CoalesceElement
- type CorruptionDetected
- type DirEntry
- type ExtentMapChunkStruct
- type ExtentMapEntryStruct
- type FragmentationReport
- type InodeDirLocation
- type InodeGroupID
- type InodeMode
- type InodeNumber
- type InodeType
- type InodeUserID
- type MetadataStruct
- type RWModeType
- type ReadPlanStep
- type Version
- type VolumeHandle
Constants ¶
const ( F_OK = InodeMode(unix.F_OK) // check for existence R_OK = InodeMode(unix.R_OK) // UID:GID check for read permission W_OK = InodeMode(unix.W_OK) // UID:GID check for write permission X_OK = InodeMode(unix.X_OK) // UID:GID check for execute permission P_OK = InodeMode((unix.R_OK | unix.W_OK | unix.X_OK) + 1) // check for ownership permissions )
The following are used in calls to Access()... either F_OK or bitwise or of R_OK, W_OK, and X_OK
const (
InodeRootUserID = InodeUserID(0)
)
const (
RootDirInodeNumber = InodeNumber(1)
)
const (
SnapShotDirName = ".snapshot"
)
Variables ¶
This section is empty.
Functions ¶
func AccountNameToVolumeName ¶
AccountNameToVolumeName returns the corresponding volumeName for the supplied accountName (if any).
func SetRWMode ¶
func SetRWMode(rwMode RWModeType) (err error)
SetRWMode sets the package to either allow all read/write operations (RWModeNormal), allow all except Write() and ProvisionObject() operations (RWModeNoWrite), or disallow any data or metadata operations (RWModeReadOnly).
func VolumeNameToAccountName ¶
VolumeNameToAccountName returns the corresponding accountName for the supplied volumeName (if any).
func VolumeNameToActivePeerPrivateIPAddr ¶
func VolumeNameToActivePeerPrivateIPAddr(volumeName string) (activePeerPrivateIPAddr string, ok bool)
VolumeNameToActivePeerPrivateIPAddr returns the Peer IP Address serving the specified VolumeName.
Types ¶
type AccessOverride ¶
type AccessOverride uint32
AccessOverride.Owner means Access() grants permission to the owner of the file even if the permission bits disallow it.
const ( NoOverride AccessOverride = iota OwnerOverride )
type CoalesceElement ¶
type CoalesceElement struct { ContainingDirectoryInodeNumber InodeNumber ElementInodeNumber InodeNumber ElementName string }
type CorruptionDetected ¶
type CorruptionDetected bool
type DirEntry ¶
type DirEntry struct { InodeNumber Basename string Type InodeType NextDirLocation InodeDirLocation }
type ExtentMapChunkStruct ¶
type ExtentMapChunkStruct struct { FileOffsetRangeStart uint64 // Holes in [FileOffsetRangeStart:FileOffsetRangeEnd) FileOffsetRangeEnd uint64 // not covered in ExtentMapEntry slice should "read-as-zero" FileSize uint64 // up to the end-of-file as indicated by FileSize ExtentMapEntry []ExtentMapEntryStruct // All will be in [FileOffsetRangeStart:FileOffsetRangeEnd) }
type ExtentMapEntryStruct ¶
type FragmentationReport ¶
type InodeDirLocation ¶
type InodeDirLocation int64
type InodeGroupID ¶
type InodeGroupID uint32
type InodeMode ¶
type InodeMode uint32
const ( PosixModeType InodeMode = 0xE000 PosixModeDir InodeMode = 0x4000 PosixModeFile InodeMode = 0x8000 PosixModeSymlink InodeMode = 0xa000 PosixModePerm InodeMode = 0777 )
NOTE: Would have liked to use os.FileMode bitmask definitions here instead of creating our own,
but unfortunately the bitmasks used by os.ModeDir and os.ModeSymlink (0x80000000 and 0x8000000) are not the same values as what is expected on the linux side (0x4000 and 0xa000).
type InodeNumber ¶
type InodeNumber uint64
type InodeUserID ¶
type InodeUserID uint32
type MetadataStruct ¶
type MetadataStruct struct { InodeType LinkCount uint64 Size uint64 CreationTime time.Time ModificationTime time.Time AccessTime time.Time AttrChangeTime time.Time // aka ctime; This field is intended to be changed by writing or by setting inode information (i.e., owner, group, link count, mode, etc.). NumWrites uint64 // only maintained for FileType inodes InodeStreamNameSlice []string Mode InodeMode UserID InodeUserID GroupID InodeGroupID }
type RWModeType ¶
type RWModeType uint8
const ( RWModeNormal RWModeType = iota // All reads, writes, etc... should be allowed RWModeNoWrite // Same as modeNormal except Write() & ProvisionObject() should fail RWModeReadOnly // No operations that modify state (data or metadata) should be allowed )
type ReadPlanStep ¶
type ReadPlanStep struct { LogSegmentNumber uint64 // If == 0, Length specifies zero-fill size Offset uint64 // If zero-fill case, == 0 Length uint64 // Must != 0 AccountName string // If == "", Length specifies a zero-fill size ContainerName string // If == "", Length specifies a zero-fill size ObjectName string // If == "", Length specifies a zero-fill size ObjectPath string // If == "", Length specifies a zero-fill size }
type VolumeHandle ¶
type VolumeHandle interface { GetFSID() (fsid uint64) SnapShotCreate(name string) (id uint64, err error) SnapShotDelete(id uint64) (err error) MakeLockID(inodeNumber InodeNumber) (lockID string, err error) InitInodeLock(inodeNumber InodeNumber, callerID dlm.CallerID) (lock *dlm.RWLockStruct, err error) GetReadLock(inodeNumber InodeNumber, callerID dlm.CallerID) (*dlm.RWLockStruct, error) GetWriteLock(inodeNumber InodeNumber, callerID dlm.CallerID) (*dlm.RWLockStruct, error) AttemptReadLock(inodeNumber InodeNumber, callerID dlm.CallerID) (*dlm.RWLockStruct, error) AttemptWriteLock(inodeNumber InodeNumber, callerID dlm.CallerID) (*dlm.RWLockStruct, error) EnsureReadLock(inodeNumber InodeNumber, callerID dlm.CallerID) (*dlm.RWLockStruct, error) EnsureWriteLock(inodeNumber InodeNumber, callerID dlm.CallerID) (*dlm.RWLockStruct, error) Access(inodeNumber InodeNumber, userID InodeUserID, groupID InodeGroupID, otherGroupIDs []InodeGroupID, accessMode InodeMode, override AccessOverride) (accessReturn bool) Purge(inodeNumber InodeNumber) (err error) Destroy(inodeNumber InodeNumber) (err error) GetMetadata(inodeNumber InodeNumber) (metadata *MetadataStruct, err error) GetType(inodeNumber InodeNumber) (inodeType InodeType, err error) GetLinkCount(inodeNumber InodeNumber) (linkCount uint64, err error) SetLinkCount(inodeNumber InodeNumber, linkCount uint64) (err error) SetCreationTime(inodeNumber InodeNumber, creationTime time.Time) (err error) SetModificationTime(inodeNumber InodeNumber, modificationTime time.Time) (err error) SetAccessTime(inodeNumber InodeNumber, accessTime time.Time) (err error) SetPermMode(inodeNumber InodeNumber, filePerm InodeMode) (err error) SetOwnerUserID(inodeNumber InodeNumber, userID InodeUserID) (err error) SetOwnerUserIDGroupID(inodeNumber InodeNumber, userID InodeUserID, groupID InodeGroupID) (err error) SetOwnerGroupID(inodeNumber InodeNumber, groupID InodeGroupID) (err error) GetStream(inodeNumber InodeNumber, inodeStreamName string) (buf []byte, err error) PutStream(inodeNumber InodeNumber, inodeStreamName string, buf []byte) (err error) DeleteStream(inodeNumber InodeNumber, inodeStreamName string) (err error) FetchOnDiskInode(inodeNumber InodeNumber) (corruptionDetected CorruptionDetected, version Version, onDiskInode []byte, err error) PatchInode(inodeNumber InodeNumber, inodeType InodeType, linkCount uint64, mode InodeMode, userID InodeUserID, groupID InodeGroupID, parentInodeNumber InodeNumber, symlinkTarget string) (err error) FetchLayoutReport(inodeNumber InodeNumber) (layoutReport sortedmap.LayoutReport, err error) FetchFragmentationReport(inodeNumber InodeNumber) (fragmentationReport FragmentationReport, err error) Optimize(inodeNumber InodeNumber, maxDuration time.Duration) (err error) Validate(inodeNumber InodeNumber, deeply bool) (err error) CreateDir(filePerm InodeMode, userID InodeUserID, groupID InodeGroupID) (dirInodeNumber InodeNumber, err error) Link(dirInodeNumber InodeNumber, basename string, targetInodeNumber InodeNumber, insertOnly bool) (err error) Unlink(dirInodeNumber InodeNumber, basename string, removeOnly bool) (toDestroyInodeNumber InodeNumber, err error) Move(srcDirInodeNumber InodeNumber, srcBasename string, dstDirInodeNumber InodeNumber, dstBasename string) (toDestroyInodeNumber InodeNumber, err error) Lookup(dirInodeNumber InodeNumber, basename string) (targetInodeNumber InodeNumber, err error) NumDirEntries(dirInodeNumber InodeNumber) (numEntries uint64, err error) ReadDir(dirInodeNumber InodeNumber, maxEntries uint64, maxBufSize uint64, prevReturned ...interface{}) (dirEntrySlice []DirEntry, moreEntries bool, err error) AddDirEntry(dirInodeNumber InodeNumber, dirEntryName string, dirEntryInodeNumber InodeNumber, skipDirLinkCountIncrementOnSubDirEntry bool, skipSettingDotDotOnSubDirEntry bool, skipDirEntryLinkCountIncrementOnNonSubDirEntry bool) (err error) ReplaceDirEntries(parentDirInodeNumber InodeNumber, parentDirEntryBasename string, dirInodeNumber InodeNumber, dirEntryInodeNumbers []InodeNumber) (err error) CreateFile(filePerm InodeMode, userID InodeUserID, groupID InodeGroupID) (fileInodeNumber InodeNumber, err error) Read(inodeNumber InodeNumber, offset uint64, length uint64, profiler *utils.Profiler) (buf []byte, err error) GetReadPlan(fileInodeNumber InodeNumber, offset *uint64, length *uint64) (readPlan []ReadPlanStep, err error) FetchExtentMapChunk(fileInodeNumber InodeNumber, fileOffset uint64, maxEntriesFromFileOffset int64, maxEntriesBeforeFileOffset int64) (extentMapChunk *ExtentMapChunkStruct, err error) Write(fileInodeNumber InodeNumber, offset uint64, buf []byte, profiler *utils.Profiler) (err error) ProvisionObject() (objectPath string, err error) Wrote(fileInodeNumber InodeNumber, containerName string, objectName string, fileOffset []uint64, objectOffset []uint64, length []uint64, wroteTime time.Time, patchOnly bool) (err error) SetSize(fileInodeNumber InodeNumber, Size uint64) (err error) Flush(fileInodeNumber InodeNumber, andPurge bool) (err error) Coalesce(destInodeNumber InodeNumber, metaDataName string, metaData []byte, elements []*CoalesceElement) (attrChangeTime time.Time, modificationTime time.Time, numWrites uint64, fileSize uint64, err error) DefragmentFile(fileInodeNumber InodeNumber, startingFileOffset uint64, chunkSize uint64) (nextFileOffset uint64, eofReached bool, err error) CreateSymlink(target string, filePerm InodeMode, userID InodeUserID, groupID InodeGroupID) (symlinkInodeNumber InodeNumber, err error) GetSymlink(symlinkInodeNumber InodeNumber) (target string, err error) }
func FetchVolumeHandle ¶
func FetchVolumeHandle(volumeName string) (volumeHandle VolumeHandle, err error)
FetchVolumeHandle returns a the VolumeHandle corresponding to the name VolumeName.
Note: The method should be considered a write operation on the RoodDirInodeNumber.
As such, an exclusive lock should be held around a call to FetchVolumeHandle().