fid

package
v0.0.0-...-2bf1e3b Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FID

type FID [10]byte

A unique identifier used to track individual files generated by the storage implementation.

FID's are currently comprised of two parts (all big endian): 32 bites of a timestamp 16 bit globally auto incrementing number. 32 bit machine id.

func ParseID

func ParseID(s string) (FID, uint64, uint32, error)

Parses a full ID string into a FID, start and length values. This will automatically account for short and long ID names.

func (*FID) Generate

func (f *FID) Generate(machID uint32)

Generates a new file id and populates the values inside of the passed FID. This will overwrite any existing data.

func (*FID) ID

func (f *FID) ID(start uint64, length uint32) string

Generates a new unique positional id for an object stored within this file.

func (*FID) Machine

func (f *FID) Machine() uint32

Returns the machine that generated this fid.

func (*FID) Parse

func (f *FID) Parse(s string) error

func (*FID) String

func (f *FID) String() string

type Formatter

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

func NewFormatter

func NewFormatter(s string) (*Formatter, error)

Creates a new formatter from the given format string. If the string is not a valid format syntax then this will return an error.

func (*Formatter) Format

func (f *Formatter) Format(fid FID) string

Takes a FID and returns the formatted string using the configured Formatter.

Jump to

Keyboard shortcuts

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