Documentation
¶
Index ¶
Constants ¶
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 ¶
var EOF = errors.New("EOF")
var MISSING_ARG = errors.New("missing required arg")
var NOT_FOUND = errors.New("Primitive Not Found")
Functions ¶
func CloseRoach ¶
func CloseRoach()
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 ¶
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 (*Primitive) Find ¶
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 ¶
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