storage

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2016 License: Apache-2.0 Imports: 12 Imported by: 15

Documentation

Overview

storage is the package which implements the underlying, on-disk storage API for Torus servers. A single node can be tested with just a storage implementation, but the distributor replaces it as a virtual implementation of a much larger storage pool, provided by the cluster. This is storage underneath a single node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMFile

func CreateMFile(path string, size uint64) error

Types

type MFile

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

func CreateOrOpenMFile

func CreateOrOpenMFile(path string, size uint64, blkSize uint64) (*MFile, error)

func OpenMFile

func OpenMFile(path string, blkSize uint64) (*MFile, error)

func (*MFile) Close

func (m *MFile) Close() error

func (*MFile) Flush

func (m *MFile) Flush() error

func (*MFile) GetBlock

func (m *MFile) GetBlock(n uint64) []byte

GetBlock returns the n-th block as a byte slice, including any trailing zero padding. The returned bytes are from the underlying mmap'd buffer and will be invalid after a call to Close().

func (*MFile) NumBlocks

func (m *MFile) NumBlocks() uint64

NumBlocks returns the total capacity of the file in blocks.

func (*MFile) WriteBlock

func (m *MFile) WriteBlock(n uint64, data []byte) error

WriteBlock writes data to the n-th block in the file.

Jump to

Keyboard shortcuts

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