Documentation
¶
Index ¶
- Constants
- func StartMappingProxy(bind, pilosa string, m Translator) error
- type AttrMapper
- type BinaryFloatMapper
- type BinaryIntMapper
- type Bit
- type BitMapper
- type BoltTranslator
- type BoolMapper
- type BucketVLock
- type Bytes
- type ChanBitIterator
- type ChanValIterator
- type CustomMapper
- type DayOfMonthMapper
- type DayOfWeekMapper
- type Errors
- type FieldSpec
- type FileFragment
- type FloatMapper
- type FloatParser
- type FrameSpec
- type GridMapper
- type GridToFloatMapper
- type IPParser
- type ImportClient
- type Index
- type Indexer
- type IntMapper
- type IntParser
- type LevelTranslator
- type LinearFloatMapper
- type Mapper
- type MonthMapper
- type Nexter
- type Parser
- type PilosaImporter
- type Point
- type Region
- type RegionMapper
- type SingleVLock
- type SparseIntMapper
- type StringContainsMapper
- type StringMatchesMapper
- type StringParser
- type TimeOfDayMapper
- type TimeParser
- type Translator
- type ValueLocker
- type YearMapper
Constants ¶
const ( BYTE = 1.0 KILOBYTE = 1024 * BYTE MEGABYTE = 1024 * KILOBYTE GIGABYTE = 1024 * MEGABYTE TERABYTE = 1024 * GIGABYTE )
Variables ¶
This section is empty.
Functions ¶
func StartMappingProxy ¶
func StartMappingProxy(bind, pilosa string, m Translator) error
StartMappingProxy listens for incoming http connections on `bind` and forwards all requests to `pilosa`. It inspects pilosa responses and runs the row ids through the Translator `m` to translate them to whatever they were mapped from. This function does not return unless there is a problem (like http.ListenAndServe).
Types ¶
type AttrMapper ¶
AttrMapper is a struct for mapping some set of data fields to a value for sending to Pilosa as a SetColumnAttrs query
type BinaryFloatMapper ¶
type BinaryFloatMapper struct { Min float64 Max float64 BitDepth int // contains filtered or unexported fields }
BinaryFloatMapper is a Mapper for float types, mapping to a set of buckets representing the value in a binary sense
func (BinaryFloatMapper) ID ¶
func (m BinaryFloatMapper) ID(fi ...interface{}) (rowIDs []int64, err error)
ID maps floats to binary bit sets
type BinaryIntMapper ¶
type BinaryIntMapper struct { Min int64 Max int64 BitDepth int // contains filtered or unexported fields }
BinaryIntMapper is a Mapper for int types, mapping to a set of buckets representing the value in a binary sense
func (BinaryIntMapper) ID ¶
func (m BinaryIntMapper) ID(ii ...interface{}) (rowIDs []int64, err error)
ID maps floats to binary bit sets
type BitMapper ¶
BitMapper is a struct for mapping some set of data fields to a (frame, id) combination for sending to Pilosa as a SetBit query
type BoltTranslator ¶
BoltTranslator is a Translator which stores the two way val/id mapping in boltdb. It only accepts string values to map.
func NewBoltTranslator ¶
func NewBoltTranslator(filename string, frames ...string) (bt *BoltTranslator, err error)
func (*BoltTranslator) BulkAdd ¶
func (bt *BoltTranslator) BulkAdd(frame string, values [][]byte) error
func (*BoltTranslator) Close ¶
func (bt *BoltTranslator) Close() error
func (*BoltTranslator) Get ¶
func (bt *BoltTranslator) Get(frame string, id uint64) (val interface{})
Get returns the previously mapped value to the monotonic id generated from GetID. For BoltTranslator, val will always be a []byte.
type BoolMapper ¶
type BoolMapper struct { }
BoolMapper is a trivial Mapper for boolean types
func (BoolMapper) ID ¶
func (m BoolMapper) ID(bi ...interface{}) (rowIDs []int64, err error)
ID maps a bool to a rowID (identity mapper)
type BucketVLock ¶
type BucketVLock struct {
// contains filtered or unexported fields
}
func NewBucketVLock ¶
func NewBucketVLock() BucketVLock
func (BucketVLock) Lock ¶
func (b BucketVLock) Lock(val []byte)
func (BucketVLock) Unlock ¶
func (b BucketVLock) Unlock(val []byte)
type Bytes ¶
type Bytes uint64
type ChanBitIterator ¶
func NewChanBitIterator ¶
func NewChanBitIterator() ChanBitIterator
type ChanValIterator ¶
type ChanValIterator chan pcli.FieldValue
func NewChanValIterator ¶
func NewChanValIterator() ChanValIterator
func (ChanValIterator) NextValue ¶
func (c ChanValIterator) NextValue() (pcli.FieldValue, error)
type CustomMapper ¶
type CustomMapper struct { Func func(...interface{}) interface{} Mapper Mapper }
CustomMapper is a Mapper that applies a function to a slice of fields, then applies a simple Mapper to the result of that, returning a rowID. This is a generic way to support mappings which span multiple fields. It is not supported by the importing config system.
func (CustomMapper) ID ¶
func (m CustomMapper) ID(fields ...interface{}) (rowIDs []int64, err error)
ID maps a set of fields using a custom function
type DayOfMonthMapper ¶
type DayOfMonthMapper struct { }
func (DayOfMonthMapper) ID ¶
func (m DayOfMonthMapper) ID(ti ...interface{}) (rowIDs []int64, err error)
ID maps a timestamp to a day of month bucket (1-31)
type DayOfWeekMapper ¶
type DayOfWeekMapper struct { }
DayOfWeekMapper is a Mapper for timestamps, mapping the day of week only
func (DayOfWeekMapper) ID ¶
func (m DayOfWeekMapper) ID(ti ...interface{}) (rowIDs []int64, err error)
ID maps a timestamp to a day of week bucket
type FileFragment ¶
type FileFragment struct {
// contains filtered or unexported fields
}
func NewFileFragment ¶
func NewFileFragment(f *os.File, startLoc, endLoc int64) (*FileFragment, error)
func SplitFileLines ¶
func SplitFileLines(f *os.File, numParts int64) ([]*FileFragment, error)
func (*FileFragment) Close ¶
func (ff *FileFragment) Close() error
type FloatMapper ¶
type FloatMapper struct { Buckets []float64 // slice representing bucket intervals [left0 left1 ... leftN-1 rightN-1] // contains filtered or unexported fields }
FloatMapper is a Mapper for float types, mapping to arbitrary buckets
func (FloatMapper) ID ¶
func (m FloatMapper) ID(fi ...interface{}) (rowIDs []int64, err error)
ID maps floats to arbitrary buckets
type FloatParser ¶
type FloatParser struct { }
FloatParser is a parser for float types
func (FloatParser) Parse ¶
func (p FloatParser) Parse(field string) (result interface{}, err error)
Parse parses a float string to a float64 value
type FrameSpec ¶
type FrameSpec struct { Name string CacheType pcli.CacheType CacheSize uint InverseEnabled bool Fields []FieldSpec }
func NewFieldFrameSpec ¶
NewFieldFrameSpec creates a frame which is dedicated to a single BSI field which will have the same name as the frame
func NewRankedFrameSpec ¶
type GridMapper ¶
type GridMapper struct { Xmin float64 Xmax float64 Xres int64 Ymin float64 Ymax float64 Yres int64 // contains filtered or unexported fields }
GridMapper is a Mapper for a 2D grid (e.g. small-scale latitude/longitude)
func (GridMapper) ID ¶
func (m GridMapper) ID(xyi ...interface{}) (rowIDs []int64, err error)
ID maps pairs of floats to regular buckets
type GridToFloatMapper ¶
type GridToFloatMapper struct {
// contains filtered or unexported fields
}
func NewGridToFloatMapper ¶
func NewGridToFloatMapper(gm GridMapper, lfm LinearFloatMapper, gridVals []float64) GridToFloatMapper
func (GridToFloatMapper) ID ¶
func (m GridToFloatMapper) ID(vals ...interface{}) ([]int64, error)
type ImportClient ¶
type ImportClient struct { BufferSize int // contains filtered or unexported fields }
func NewImportClient ¶
func NewImportClient(host, index string, frames []string, bufsize int) *ImportClient
func (*ImportClient) Close ¶
func (ic *ImportClient) Close()
func (*ImportClient) SetBit ¶
func (ic *ImportClient) SetBit(rowID, columnID uint64, frame string)
func (*ImportClient) SetBitTimestamp ¶
func (ic *ImportClient) SetBitTimestamp(rowID, columnID uint64, frame string, timestamp time.Time)
type Indexer ¶
type IntMapper ¶
type IntMapper struct { Min int64 Max int64 Res int64 // number of bins // contains filtered or unexported fields }
IntMapper is a Mapper for integer types, mapping each int in the range to a row
type LevelTranslator ¶
type LevelTranslator struct {
// contains filtered or unexported fields
}
LevelTranslator is a Translator which stores the two way val/id mapping in leveldb.
func NewLevelTranslator ¶
func NewLevelTranslator(dirname string, frames ...string) (lt *LevelTranslator, err error)
func (*LevelTranslator) Close ¶
func (lt *LevelTranslator) Close() error
func (*LevelTranslator) Get ¶
func (lt *LevelTranslator) Get(frame string, id uint64) (val interface{})
type LinearFloatMapper ¶
type LinearFloatMapper struct { Min float64 Max float64 Res float64 Scale string // linear, logarithmic // contains filtered or unexported fields }
LinearFloatMapper is a Mapper for float types, mapping to regularly spaced buckets TODO: consider defining this in terms of a linear mapping ID = floor(a*value + b)
func (LinearFloatMapper) ID ¶
func (m LinearFloatMapper) ID(fi ...interface{}) (rowIDs []int64, err error)
ID maps floats to regularly spaced buckets
type Mapper ¶
Mapper represents a single method for mapping a specific data type to a slice of row IDs. A data type might be composed of multiple fields (e.g. a 2D point). A data type might use multiple mappers.
type MonthMapper ¶
type MonthMapper struct { }
MonthMapper is a Mapper for timestamps, mapping the month only
func (MonthMapper) ID ¶
func (m MonthMapper) ID(ti ...interface{}) (rowIDs []int64, err error)
ID maps a timestamp to a month bucket (1-12)
type Nexter ¶
type Nexter struct {
// contains filtered or unexported fields
}
Nexter is a threadsafe monotonic unique id generator
type PilosaImporter ¶
type Region ¶
type Region struct {
Vertices []Point
}
Region is a simple polygonal region of R2 space
type RegionMapper ¶
type RegionMapper struct { Regions []Region // contains filtered or unexported fields }
RegionMapper is a Mapper for a set of geometric regions (e.g. neighborhoods or states) TODO: generate regions by reading shapefile
type SingleVLock ¶
type SingleVLock struct {
// contains filtered or unexported fields
}
func NewSingleVLock ¶
func NewSingleVLock() SingleVLock
func (SingleVLock) Lock ¶
func (s SingleVLock) Lock(val []byte)
func (SingleVLock) Unlock ¶
func (s SingleVLock) Unlock(val []byte)
type SparseIntMapper ¶
type SparseIntMapper struct { Min int64 Max int64 Map map[int64]int64 // contains filtered or unexported fields }
SparseIntMapper is a Mapper for integer types, mapping only relevant ints
func (SparseIntMapper) ID ¶
func (m SparseIntMapper) ID(ii ...interface{}) (rowIDs []int64, err error)
ID maps arbitrary ints to a rowID range
type StringContainsMapper ¶
type StringContainsMapper struct {
Matches []string // slice of strings to check for containment
}
StringContainsMapper is a Mapper for string types...
type StringMatchesMapper ¶
type StringMatchesMapper struct {
Matches []string // slice of strings to check for match
}
StringMatchesMapper is a Mapper for string types...
type StringParser ¶
type StringParser struct { }
StringParser is a parser for string types
func (StringParser) Parse ¶
func (p StringParser) Parse(field string) (result interface{}, err error)
Parse is an identity parser for strings
type TimeOfDayMapper ¶
type TimeOfDayMapper struct {
Res int64
}
TimeOfDayMapper is a Mapper for timestamps, mapping the time component only TODO: consider putting all time buckets in same frame pros: single frame cons: would have to abandon the simple ID interface. also single frame may not be a good thing
func (TimeOfDayMapper) ID ¶
func (m TimeOfDayMapper) ID(ti ...interface{}) (rowIDs []int64, err error)
ID maps a timestamp to a time of day bucket
type TimeParser ¶
type TimeParser struct {
Layout string
}
TimeParser is a parser for timestamps
func (TimeParser) Parse ¶
func (p TimeParser) Parse(field string) (result interface{}, err error)
Parse parses a timestamp string to a time.Time value
type Translator ¶
type Translator interface { // Get must be safe for concurrent access Get(frame string, id uint64) interface{} GetID(frame string, val interface{}) (uint64, error) }
Translator describes the functionality which the proxy server requires to translate row ids to what they were mapped from.
type ValueLocker ¶
type YearMapper ¶
type YearMapper struct {
MinYear int64 // TODO? use this to eliminate empty rows for year < 2000 or whatever
}
YearMapper is a Mapper for timestamps, mapping the year only
func (YearMapper) ID ¶
func (m YearMapper) ID(ti ...interface{}) (rowIDs []int64, err error)
ID maps a timestamp to a year bucket