storage

package
v0.0.0-...-6b52c20 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2017 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RowsToRead = 1024
)
View Source
const (
	SuperBlockSize = 8
)

Variables

This section is empty.

Functions

func ParseKeyHash

func ParseKeyHash(key_hash_string string) (uint64, uint32)

Types

type Needle

type Needle struct {
	Cookie   uint32 "random number to mitigate brute force lookups"
	Key      uint64 "file id"
	Size     uint32 "Data size"
	Data     []byte "The actual file data"
	Checksum int32  "CRC32 to check integrity"
	Padding  []byte "Aligned to 8 bytes"
}

func NewNeedle

func NewNeedle(r *http.Request) (n *Needle, e error)

func ReadNeedle

func ReadNeedle(r *os.File) (*Needle, uint32)

func (*Needle) Append

func (n *Needle) Append(w io.Writer) uint32

func (*Needle) ParsePath

func (n *Needle) ParsePath(fid string)

func (*Needle) Read

func (n *Needle) Read(r io.Reader, size uint32) (int, error)

type NeedleMap

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

func LoadNeedleMap

func LoadNeedleMap(file *os.File) *NeedleMap

func NewNeedleMap

func NewNeedleMap(file *os.File) *NeedleMap

func (*NeedleMap) Close

func (nm *NeedleMap) Close()

func (*NeedleMap) Delete

func (nm *NeedleMap) Delete(key uint64)

func (*NeedleMap) Get

func (nm *NeedleMap) Get(key uint64) (element *NeedleValue, ok bool)

func (*NeedleMap) Put

func (nm *NeedleMap) Put(key uint64, offset uint32, size uint32) (int, error)

type NeedleValue

type NeedleValue struct {
	Offset uint32 "Volume offset" //since aligned to 8 bytes, range is 4G*8=32G
	Size   uint32 "Size of the data portion"
}

type Store

type Store struct {
	Port      int
	PublicUrl string
	// contains filtered or unexported fields
}

func NewStore

func NewStore(port int, publicUrl, dirname string, volumeListString string) (s *Store)

func (*Store) AddVolume

func (s *Store) AddVolume(volumeListString string) error

func (*Store) Close

func (s *Store) Close()

func (*Store) Delete

func (s *Store) Delete(i uint64, n *Needle) uint32

func (*Store) Join

func (s *Store) Join(mserver string)

func (*Store) Read

func (s *Store) Read(i uint64, n *Needle) (int, error)

func (*Store) Status

func (s *Store) Status() *[]*VolumeInfo

func (*Store) Write

func (s *Store) Write(i uint64, n *Needle) uint32

type Volume

type Volume struct {
	Id uint32
	// contains filtered or unexported fields
}

func NewVolume

func NewVolume(dirname string, id uint32) (v *Volume)

func (*Volume) Close

func (v *Volume) Close()

func (*Volume) Size

func (v *Volume) Size() int64

type VolumeInfo

type VolumeInfo struct {
	Id   uint32
	Size int64
}

Jump to

Keyboard shortcuts

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