Documentation
¶
Index ¶
Constants ¶
View Source
const ( ShardByID = "id" ShardByNamespace = "collection" ShardAutomatic = "auto" )
View Source
const (
DefaultHashValue = 0
)
Variables ¶
This section is empty.
Functions ¶
func GetIdOrNSFromOplog ¶
func GetIdOrNSFromOplog(log *PartialLog) interface{}
func LogEntryEncode ¶
func LogEntryEncode(logs []*GenericOplog) [][]byte
Types ¶
type GenericOplog ¶
type GenericOplog struct { Raw []byte Parsed *PartialLog }
type Hasher ¶
type Hasher interface {
DistributeOplogByMod(log *PartialLog, mod int) uint32
}
type PartialLog ¶
type PartialLog struct { Timestamp bson.MongoTimestamp `bson:"ts"` Operation string `bson:"op"` Gid string `bson:"g"` Namespace string `bson:"ns"` Object bson.M `bson:"o"` Query bson.M `bson:"o2"` UniqueIndexes bson.M `bson:"uk"` /* * Every field subsequent declared is NEVER persistent or * transfer on network connection. They only be parsed from * respective logic */ UniqueIndexesUpdates bson.M // generate by CollisionMatrix RawSize int // generate by Decorator SourceId int // generate by Validator }
func LogParsed ¶
func LogParsed(logs []*GenericOplog) []*PartialLog
type PrimaryKeyHasher ¶
type PrimaryKeyHasher struct {
Hasher
}
func (*PrimaryKeyHasher) DistributeOplogByMod ¶
func (objectIdHasher *PrimaryKeyHasher) DistributeOplogByMod(log *PartialLog, mod int) uint32
we need to ensure that oplog entry will be sent to the same job[$hash] if they have the same ObjectID. thus we can consume the oplog entry sequentially
type TableHasher ¶
type TableHasher struct {
Hasher
}
func (*TableHasher) DistributeOplogByMod ¶
func (collectionHasher *TableHasher) DistributeOplogByMod(log *PartialLog, mod int) uint32
Click to show internal directories.
Click to hide internal directories.