diskserver

package
v0.0.0-...-c07845e Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2015 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadMetadata

func ReadMetadata(primaryFile, secondaryFile fs.File, metadata *Metadata) (err error)

func WriteMetadata

func WriteMetadata(primaryFile, secondaryFile fs.File, metadata *Metadata) error

Types

type Config

type Config struct {
	Bind  string
	Dir   string
	Limit uint64
	ACL   auth.ACL
}

func (*Config) AddFlags

func (cfg *Config) AddFlags(fs *flag.FlagSet)

func (*Config) Listen

func (cfg *Config) Listen() (net.Listener, error)

func (*Config) Validate

func (cfg *Config) Validate() error

type FreeBlockList

type FreeBlockList []uint32

func (FreeBlockList) Len

func (x FreeBlockList) Len() int

func (FreeBlockList) Less

func (x FreeBlockList) Less(i, j int) bool

func (FreeBlockList) Swap

func (x FreeBlockList) Swap(i, j int)

type Metadata

type Metadata struct {
	Mutex      sync.RWMutex
	MinUnused  uint32
	Used       UsedBlockList
	Free       FreeBlockList
	BackupData []byte
}

func (*Metadata) Insert

func (md *Metadata) Insert(slot int, addr common.Addr) (blknum uint32, inserted bool)

func (*Metadata) Remove

func (md *Metadata) Remove(slot int, addr common.Addr) (minUnused uint32, deleted bool)

func (*Metadata) Search

func (md *Metadata) Search(addr common.Addr) (slot int, blknum uint32, found bool)

type Server

type Server struct {
	Mutex        sync.Mutex
	Metadata     Metadata
	BlocksTotal  uint32
	ACL          auth.ACL
	Auther       auth.Auther
	FS           fs.FileSystem
	MetadataFile fs.File
	BackupFile   fs.File
	DataFile     fs.BlockFile
}

func New

func New(cfg Config) *Server

func (*Server) Close

func (srv *Server) Close() error

func (*Server) Get

func (srv *Server) Get(ctx context.Context, in *proto.GetRequest) (out *proto.GetReply, err error)

func (*Server) Open

func (srv *Server) Open() (err error)

func (*Server) Put

func (srv *Server) Put(ctx context.Context, in *proto.PutRequest) (out *proto.PutReply, err error)

func (*Server) Remove

func (srv *Server) Remove(ctx context.Context, in *proto.RemoveRequest) (out *proto.RemoveReply, err error)

func (*Server) Stat

func (srv *Server) Stat(ctx context.Context, in *proto.StatRequest) (out *proto.StatReply, err error)

func (*Server) Walk

func (srv *Server) Walk(in *proto.WalkRequest, stream proto.CAS_WalkServer) (err error)

type UsedBlock

type UsedBlock struct {
	Addr        common.Addr
	BlockNumber uint32
}

type UsedBlockList

type UsedBlockList []UsedBlock

func (UsedBlockList) Len

func (x UsedBlockList) Len() int

func (UsedBlockList) Less

func (x UsedBlockList) Less(i, j int) bool

func (UsedBlockList) Swap

func (x UsedBlockList) Swap(i, j int)

Jump to

Keyboard shortcuts

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