Documentation ¶
Overview ¶
Package symbol manages symbols. Symbols are deduped strings represented as small integers.
Index ¶
Constants ¶
const AnonAccName = "_acc"
AnonAccName and AnonValName are passed to the reduce combiner.
const AnonRowName = "_"
AnonRowName is a variable used to store a row that's not a struct. For a struct, each field becomes a separate variable.
const AnonValName = "_val"
const ( // Invalid is a sentinel. Invalid = ID(0) )
Variables ¶
var ( // List of frequently used symbols. Chrom = Intern("chrom") Date = Intern("date") Default = Intern("default") End = Intern("end") Feat = Intern("feat") Filter = Intern("filter") Key = Intern("key") Length = Intern("length") Map = Intern("map") Name = Intern("name") Path = Intern("path") Pos = Intern("pos") Row = Intern("row") Shards = Intern("shards") Start = Intern("start") Type = Intern("type") Value = Intern("value") Subshard = Intern("subshard") Depth = Intern("depth") Mode = Intern("mode") GZIP = Intern("gzip") // Fragment table field names. Reference = Intern("reference") // BAM table field names. MapQ = Intern("mapq") Cigar = Intern("cigar") Flags = Intern("flags") RNext = Intern("rnext") PNext = Intern("pnext") TLen = Intern("tlen") Seq = Intern("seq") Qual = Intern("qual") // AuxTags contains common aux tags. AuxTags = map[sam.Tag]ID{} AuxTagsIndex = map[ID]sam.Tag{} AnonRow = Intern(AnonRowName) AnonAcc = Intern(AnonAccName) AnonVal = Intern(AnonValName) )
Functions ¶
func MarkPreInternedSymbols ¶
func MarkPreInternedSymbols()
MarkPreInternedSymbols must be called at the end of gql initialization.
Types ¶
type ID ¶
type ID int32
ID represents an interned symbol.
func (ID) MarshalBinary ¶
MarshalBinary implements the GOB interface.
func (ID) Str ¶
Str returns a human-readable string.
Note: we don't call it String() since it makes the code deadlock prone.
func (*ID) UnmarshalBinary ¶
UnmarshalBinary implements the GOB interface.
type SymbolMap ¶
type SymbolMap struct {
// contains filtered or unexported fields
}
SymbolMap is a concurrent map. A reader can access the map without lock, regardless of background updates. The writer side must coordinate using an external mutex if there are multiple writers. This map is linearizable.
Example:
m := NewSymbolMap(10) go func() { // writer m.Store("foo", "bar") }() go func() { // reader val, ok := m.Load("foo") }
func NewSymbolMap ¶
NewSymbolMap creates a new map. Arg initialLenHint suggests the the initial capacity. If you plan to store 100 keys, then pass 100 as the value. If you don't know the capacity, pass 0 as initialLenHint.