mode

package
v0.0.0-...-e9fd6c2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CHUNK_SIZE = 255000

Default chunk size for storage of primitives, 255kb limit for values in mongo gridfs appears to offer a reasonable tradeoff between performance and memory usage

Variables

View Source
var EOF = errors.New("EOF")
View Source
var MISSING_ARG = errors.New("missing required arg")
View Source
var NOT_FOUND = errors.New("Primitive Not Found")

Functions

func CloseRoach

func CloseRoach()

func OpenRoach

func OpenRoach(hostname string, port int)

Types

type Primitive

type Primitive struct {
	Id       string `json:"id"` // UUID of the primitive
	Name     string `json:"name"`
	Length   int    `json:"length"`              // number of bytes written to database
	CSize    int    `json:"chunkSize,omitempty"` // size of chunks in this primitive
	Chunks   int    `json:"chunks,omitempty"`    // total number of chunks written to database
	Created  string `json:"created,omitempty"`   // date file was created/uploaded
	Md5      string `json:"md5,omitempty"`       // md5 hash of file for comparison checking
	MimeType string `json:"mimeType,omitempty"`  // mime type
}

Primitive is analgous to the mongodb gridfs File type, where it specifies the details of the blob that is stored/sliced into the datamode.Primitive subspace. The Primitive is stored in the datamode.Primitive.Meta subspace

func (*Primitive) Destroy

func (p *Primitive) Destroy() error

Destroy the bytes associated with the id arg provided in the args map If the file is found, return id and number of bytes destroyed in reply otherwise return an error "Primitive Not Found"

func (*Primitive) DestroyMeta

func (p *Primitive) DestroyMeta() error

func (*Primitive) Find

func (p *Primitive) Find() error

Find an instance of Primitive, using the id arg provided in the args map If it's found return id and number of bytes read in reply, otherwise return an error "Primitive Not Found"

func (*Primitive) Make

func (p *Primitive) Make(reader *bufio.Reader) error

Make a new instance of Primitive, using the bytes read from the reader The only args required at this level of make, is the number of bytes expected to be on the reader, making this effectively a 'framed' read type of protocol header is optional, i.e. if present, will write RES_MSG onto readWriter

func (*Primitive) Meta

func (p *Primitive) Meta() error

func (*Primitive) SetMeta

func (p *Primitive) SetMeta() error

func (*Primitive) Stream

func (p *Primitive) Stream(writer *bufio.Writer) error

Read the keys and values one row at a time, writing the value onto the stream Requires retrieving Meta first, to know how many chunks are there and to be able to generate the correct keys

Jump to

Keyboard shortcuts

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