objects

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: ISC Imports: 16 Imported by: 47

Documentation

Index

Constants

View Source
const CHUNK_VERSION = "1.0.0"
View Source
const OBJECT_VERSION = "1.0.0"

Variables

This section is empty.

Functions

func ParseFileInfoSortKeys

func ParseFileInfoSortKeys(sortKeysStr string) ([]string, error)

func SortFileInfos

func SortFileInfos(infos []FileInfo, sortKeys []string) error

Types

type Attribute

type Attribute uint8
const (
	AttributeExtended Attribute = 0
	AttributeADS      Attribute = 1
)

type CachedPath added in v1.0.3

type CachedPath struct {
	MAC         MAC      `msgpack:"MAC"`
	ObjectMAC   MAC      `msgpack:"objectMAC"`
	FileInfo    FileInfo `msgpack:"fileinfo"`
	Chunks      uint64   `msgpack:"chunks"`
	Entropy     float64  `msgpack:"entropy"`
	ContentType string   `msgpack:"content_type"`
}

func NewCachedPathFromBytes added in v1.0.3

func NewCachedPathFromBytes(serialized []byte) (*CachedPath, error)

func (*CachedPath) Serialize added in v1.0.3

func (o *CachedPath) Serialize() ([]byte, error)

func (*CachedPath) Stat added in v1.0.3

func (o *CachedPath) Stat() *FileInfo

type Chunk

type Chunk struct {
	Version    versioning.Version `msgpack:"version" json:"version"`
	ContentMAC MAC                `msgpack:"contentMAC" json:"contentMAC"`
	Length     uint32             `msgpack:"length" json:"length"`
	Entropy    float64            `msgpack:"entropy" json:"entropy"`
	Flags      uint32             `msgpack:"flags" json:"flags"`
}

func NewChunk

func NewChunk() *Chunk

func NewChunkFromBytes

func NewChunkFromBytes(serialized []byte) (*Chunk, error)

func (*Chunk) MarshalJSON

func (c *Chunk) MarshalJSON() ([]byte, error)

func (*Chunk) Serialize

func (c *Chunk) Serialize() ([]byte, error)

type FileInfo

type FileInfo struct {
	Lname      string      `json:"name" msgpack:"name"`
	Lsize      int64       `json:"size" msgpack:"size"`
	Lmode      fs.FileMode `json:"mode" msgpack:"mode"`
	LmodTime   time.Time   `json:"mod_time" msgpack:"mod_time"`
	Ldev       uint64      `json:"dev" msgpack:"dev"`
	Lino       uint64      `json:"ino" msgpack:"ino"`
	Luid       uint64      `json:"uid" msgpack:"uid"`
	Lgid       uint64      `json:"gid" msgpack:"gid"`
	Lnlink     uint16      `json:"nlink" msgpack:"nlink"`
	Lusername  string      `json:"username" msgpack:"username"`   // local addition
	Lgroupname string      `json:"groupname" msgpack:"groupname"` // local addition

	// Just in case we need something special to handle special
	// OSes.
	Flags uint32 `json:"flags" msgpack:"flags"`
}

Danger: If you add any fields here, be sure to adapt the Equal and EqualIgnoreSize methods.

func FileInfoFromStat

func FileInfoFromStat(stat fs.FileInfo) FileInfo

func NewFileInfo

func NewFileInfo(name string, size int64, mode os.FileMode, modTime time.Time, dev uint64, ino uint64, uid uint64, gid uint64, nlink uint16) FileInfo

func (FileInfo) Dev

func (f FileInfo) Dev() uint64

func (*FileInfo) Equal

func (fileinfo *FileInfo) Equal(fi *FileInfo) bool

func (*FileInfo) EqualIgnoreSize

func (fileinfo *FileInfo) EqualIgnoreSize(fi *FileInfo) bool

func (FileInfo) Gid

func (f FileInfo) Gid() uint64

func (FileInfo) Groupname

func (f FileInfo) Groupname() string

func (*FileInfo) HumanSize

func (fileinfo *FileInfo) HumanSize() string

func (FileInfo) Ino

func (f FileInfo) Ino() uint64

func (FileInfo) IsDir

func (f FileInfo) IsDir() bool

func (FileInfo) ModTime

func (f FileInfo) ModTime() time.Time

func (FileInfo) Mode

func (f FileInfo) Mode() os.FileMode

func (FileInfo) Name

func (f FileInfo) Name() string
func (f FileInfo) Nlink() uint16

func (FileInfo) Size

func (f FileInfo) Size() int64

func (FileInfo) Sys

func (f FileInfo) Sys() any

func (*FileInfo) Type

func (fileinfo *FileInfo) Type() string

func (FileInfo) Uid

func (f FileInfo) Uid() uint64

func (FileInfo) Username

func (f FileInfo) Username() string

type MAC

type MAC [32]byte
var (
	NilMac MAC
)

func RandomMAC

func RandomMAC() MAC

func (MAC) MarshalJSON

func (m MAC) MarshalJSON() ([]byte, error)

func (*MAC) UnmarshalJSON

func (m *MAC) UnmarshalJSON(data []byte) error

type Object

type Object struct {
	Version     versioning.Version `msgpack:"version" json:"version"`
	ContentMAC  MAC                `msgpack:"contentMAC" json:"contentMAC"`
	Chunks      []Chunk            `msgpack:"chunks" json:"-"`
	ContentType string             `msgpack:"content_type,omitempty" json:"content_type"`
	Entropy     float64            `msgpack:"entropy,omitempty" json:"entropy"`
	Flags       uint32             `msgpack:"flags" json:"flags"`
}

func NewObject

func NewObject() *Object

func NewObjectFromBytes

func NewObjectFromBytes(serialized []byte) (*Object, error)

func (*Object) Serialize

func (o *Object) Serialize() ([]byte, error)

func (*Object) Size

func (o *Object) Size() int64

Jump to

Keyboard shortcuts

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