nham

package
v0.0.0-...-aaf6028 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Nail-House Allocation Method.

Index

Constants

View Source
const (
	// Used for all entries.
	FeId_Master byte = iota
	FeId_Free
	FeId_Used
	FeId_SizeCount
	FeId_EndSizeCount
)

The Prefixes for FeId

Variables

View Source
var EAppendDenied = errors.New("Append Denied")

Functions

func FileTableExpire

func FileTableExpire(tx *bolt.Tx, id FileID, size int64, upToTime int) (e error)

func FileTableInsert

func FileTableInsert(tx *bolt.Tx, id FileID, size int64, timeNail int, checker AppendChecker) (finalOffset int64, ve error, e error)

func TimeToInt

func TimeToInt(t time.Time) int

Temporary.

Types

type AppendChecker

type AppendChecker func(totalFilesize int64) error
var DENIED AppendChecker = func(totalFilesize int64) error { return EAppendDenied }

type DirTable

type DirTable struct {
	Rnd            rand.Source
	MinForwardDays int
	MinTimeBuffer  int
}

func (*DirTable) Alloc

func (dt *DirTable) Alloc(tx *bolt.Tx, size int64, timeNail int, checker AppendChecker) (fid FileID, fileOffset int64, e error)

type FeId

type FeId [9]byte

func (*FeId) Get

func (f *FeId) Get() int64

func (*FeId) Offset

func (f *FeId) Offset(i int64)

func (*FeId) SetType

func (f *FeId) SetType(b byte)

func (*FeId) Zero

func (f *FeId) Zero()

type FileEntry

type FileEntry struct {
	Offset   int64
	Size     int64
	Used     bool
	TimeNail int
	// contains filtered or unexported fields
}

type FileID

type FileID [16]byte

func NewFileId

func NewFileId(src rand.Source) (f FileID)

func NewFileId64

func NewFileId64(src rand.Source64) (f FileID)

func (FileID) Equal

func (a FileID) Equal(b FileID) bool

type FileMetadata

type FileMetadata struct {
	NailHouse int
	// contains filtered or unexported fields
}

type Position

type Position struct {
	File             FileID
	Offset           int64
	Over, Head, Body int
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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