Documentation ¶
Index ¶
- Constants
- Variables
- func FromBytes(data []byte) (*hyper.DataEntry, error)
- func MakeFile(settings interface{}) (hyper.Datastore, error)
- func MakeRedis(settings interface{}) (hyper.Datastore, error)
- func Reassemble(chunks []*DataChunk) (*hyper.DataEntry, error)
- func ToBytes(e *hyper.DataEntry) []byte
- func ValidateFileSettings(settings map[string]interface{}) (interface{}, error)
- func ValidateRedisSettings(settings map[string]interface{}) (interface{}, error)
- type ByPosition
- type DataChunk
- type FileDatastore
- type FileSettings
- type Redis
- type RedisSettings
Constants ¶
View Source
const BUFFER_SIZE = 255
View Source
const CHUNK_HEADER_SIZE = 8 + CHUNK_ID_LENGTH
View Source
const CHUNK_ID_LENGTH = 16
View Source
const CHUNK_VERSION = 1
View Source
const ENTRY_VERSION = 1
Variables ¶
View Source
var Definitions = hyper.DatastoreDefinitions{ "redis": hyper.DatastoreDefinition{ Name: "Redis Datastore", Description: "For Production Use", Maker: MakeRedis, SettingsValidator: ValidateRedisSettings, }, "file": hyper.DatastoreDefinition{ Name: "File-based Datastore", Description: "An file-based datastore", Maker: MakeFile, SettingsValidator: ValidateFileSettings, }, }
View Source
var FileForm = forms.Form{ ErrorMsg: "invalid data encountered in the File config form", Fields: []forms.Field{ { Name: "filename", Validators: []forms.Validator{ forms.IsString{}, }, }, }, }
View Source
var RedisForm = forms.Form{ ErrorMsg: "invalid data encountered in the Redis config form", Fields: []forms.Field{ { Name: "addresses", Validators: []forms.Validator{ forms.IsRequired{}, forms.IsStringList{}, }, }, { Name: "key", Validators: []forms.Validator{ forms.IsOptional{Default: "entries"}, forms.IsString{}, }, }, { Name: "master_name", Validators: []forms.Validator{ forms.IsOptional{Default: ""}, forms.IsString{}, }, }, { Name: "database", Validators: []forms.Validator{ forms.IsOptional{Default: 0}, forms.IsInteger{Min: 0, Max: 100}, }, }, { Name: "password", Validators: []forms.Validator{ forms.IsRequired{}, forms.IsString{}, }, }, }, }
Functions ¶
func ValidateFileSettings ¶
func ValidateRedisSettings ¶
Types ¶
type ByPosition ¶
func (ByPosition) Len ¶
func (b ByPosition) Len() int
func (ByPosition) Less ¶
func (b ByPosition) Less(i, j int) bool
func (ByPosition) Swap ¶
func (b ByPosition) Swap(i, j int)
type DataChunk ¶
type DataChunk struct { // The number of chunks for this hash Chunks uint16 // The index of this chunk Index uint16 // The actual ID of the entry this chunk belongs to ID []byte // The actual data in this chunk Data []byte }
type FileDatastore ¶
type FileDatastore struct {
// contains filtered or unexported fields
}
A file-based data store
func (*FileDatastore) Init ¶
func (f *FileDatastore) Init() error
type FileSettings ¶
type FileSettings struct {
Filename string `json:"filename"`
}
Click to show internal directories.
Click to hide internal directories.