object

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const IdHashSize = sha1.Size

IdHashSize is the size of the byte array that contains the object hash.

View Source
const IdSliceHashSize = IdHashSize + 4

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheFlag

type CacheFlag int8
const (
	FlagCache        CacheFlag = 0        // normal cache index
	FlagVaryIndex    CacheFlag = 1 << 0   // vary index
	FlagVaryCache    CacheFlag = 0x1 << 1 // vary cache
	FlagChunkedCache CacheFlag = 0x1 << 2 // chunked index
)

func (CacheFlag) String

func (f CacheFlag) String() string

type ID

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

func NewID

func NewID(path string) *ID

func NewVirtualID

func NewVirtualID(path string, virtualKey string) *ID

func (*ID) Bytes

func (id *ID) Bytes() []byte

func (*ID) Ext

func (id *ID) Ext() string

Ext returns the ext of the ID.

func (*ID) Hash

func (id *ID) Hash() IDHash

func (*ID) HashStr

func (id *ID) HashStr() string

func (*ID) Key

func (id *ID) Key() string

Key returns the concatenation of the path and ext of the ID.

func (*ID) MarshalCBOR

func (id *ID) MarshalCBOR() ([]byte, error)

MarshalCBOR implements cbor.Marshaler.

func (*ID) MarshalJSON

func (id *ID) MarshalJSON() ([]byte, error)

func (*ID) Path

func (id *ID) Path() string

Path returns the path of the ID.

func (*ID) String

func (id *ID) String() string

func (*ID) UnmarshalCBOR

func (id *ID) UnmarshalCBOR(buf []byte) error

UnmarshalCBOR implements cbor.Unmarshaler.

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(buf []byte) error

func (*ID) WPath

func (id *ID) WPath(pwd string) string

WPath returns the read/write path of the object ID. dir F/FF/hash with path.

func (*ID) WPathSlice

func (id *ID) WPathSlice(pwd string, sliceIndex uint32) string

type IDHash

type IDHash [IdHashSize]byte

IDHash is the fixed-width byte array that represents an ObjectID hash.

func (IDHash) WPath

func (idx IDHash) WPath(pwd string) string

type IDSliceHash

type IDSliceHash [IdSliceHashSize]byte

type Metadata

type Metadata struct {
	Flags CacheFlag `json:"flags"`

	ID          *ID           `json:"id"`             // object ID
	BlockSize   uint64        `json:"bsize"`          // block size
	Chunks      bitmap.Bitmap `json:"chunks"`         // file chunk
	Parts       bitmap.Bitmap `json:"parts"`          // file chunk parts
	Code        int           `json:"code"`           // http response code
	Size        uint64        `json:"size"`           // object size
	RespUnix    int64         `json:"resp_unix"`      // response time
	LastRefUnix int64         `json:"last_ref_unix"`  // last reference time
	Refs        int64         `json:"refs"`           // reference count
	ExpiresAt   int64         `json:"expires_at"`     // expiration time
	Headers     http.Header   `json:"headers"`        // http headers
	VirtualKey  []string      `json:"vkey,omitempty"` // vary keys
}

func (*Metadata) Clone

func (m *Metadata) Clone() *Metadata

Clone clones the metadata.

func (*Metadata) HasComplete

func (m *Metadata) HasComplete() bool

func (*Metadata) HasVary

func (m *Metadata) HasVary() bool

HasVary returns true if the metadata has vary keys.

func (*Metadata) IsChunked

func (m *Metadata) IsChunked() bool

IsChunked returns true if the metadata is a chunked metadata.

func (*Metadata) IsVary

func (m *Metadata) IsVary() bool

IsVary returns true if the metadata is a vary metadata.

func (*Metadata) IsVaryCache

func (m *Metadata) IsVaryCache() bool

IsVaryCache returns true if the metadata is a vary-cache metadata.

func (*Metadata) IsVaryChunked

func (m *Metadata) IsVaryChunked() bool

IsVaryChunked returns true if the metadata is a vary-cache-chunked metadata.

Jump to

Keyboard shortcuts

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