Discover Packages
github.com/daviddengcn/sophie
kv
package
Version:
v0.0.0-...-731618e
Opens a new window with list of versions in this module.
Published: Mar 13, 2016
License: BSD-2-Clause
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 49
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package kv supporting read and write of a simple file formating for Sophie, which
stores key-value pairs.
KVFile format:
vint(key-len) key vint(val-len) val
func ReadAsByteOffs(fp sophie.FsPath) (buffer bytesp.Slice, keyOffs, keyEnds, valOffs, valEnds villa.IntSlice, ...)
func WriteByteOffs(fp sophie.FsPath, buffer []byte, keyOffs, keyEnds, valOffs, valEnds []int) error
type DirInput
type DirOutput
type Reader
type Writer
func ReadAsByteOffs(fp sophie .FsPath ) (buffer bytesp.Slice, keyOffs, keyEnds, valOffs, valEnds villa.IntSlice, err error )
ReadAsByteOffs reads a kv file as a slice of buffer and some int slices
of key offsets, key ends, value offsets, and value ends.
WriteByteOffs generates a kv file with key-value pairs represented as a
slice of buffer and some int slices of key offsets, key ends, value offsets,
and value ends.
A folder with KV Files as an mr.Input
A folder with KV Files as an Output
Clean removes the folder.
kv.Reader is a struct for reading a kv file.
NewReader returns a *Reader for reading the kv file at the specified FsPath.
Next fetches next key/val pair
kv.Writer is a struct for generating a kv file.
*kv.Writer implements the sophie.CollectCloser interface.
NewWriter returns a *kv.Writer for writing a kv file at the specified FsPath.
sophie.CollectCloser interface
Source Files
¶
Click to show internal directories.
Click to hide internal directories.