Documentation ¶
Index ¶
- Constants
- func ConvertBsonD2M(input bson.D) (bson.M, map[string]struct{})
- func ExtraCommandName(o bson.D) (string, bool)
- func GetIdOrNSFromOplog(log *PartialLog) interface{}
- func GetKey(log bson.D, wanted string) interface{}
- func GetKeyWithIndex(log bson.D, wanted string) (interface{}, int)
- func Hash(hashObject interface{}) uint32
- func IsRunOnAdminCommand(operation string) bool
- func IsSyncDataCommand(operation string) bool
- func LogEntryEncode(logs []*GenericOplog) [][]byte
- func RemoveFiled(input bson.D, key string) bson.D
- func SetFiled(input bson.D, key string, value interface{})
- type CommandOperation
- type GenericOplog
- type Hasher
- type PartialLog
- type PrimaryKeyHasher
- type TableHasher
Constants ¶
View Source
const ( VersionMark = "$v" UuidMark = "ui" )
View Source
const ( ShardByID = "id" ShardByNamespace = "collection" ShardAutomatic = "auto" )
View Source
const (
DefaultHashValue = 0
)
View Source
const (
PrimaryKey = "_id"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertBsonD2M ¶
convert bson.D to bson.M
func GetIdOrNSFromOplog ¶
func GetIdOrNSFromOplog(log *PartialLog) interface{}
func IsRunOnAdminCommand ¶
func IsSyncDataCommand ¶
func LogEntryEncode ¶
func LogEntryEncode(logs []*GenericOplog) [][]byte
Types ¶
type CommandOperation ¶
type CommandOperation struct {
// contains filtered or unexported fields
}
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.D `bson:"o"` Query bson.M `bson:"o2"` UniqueIndexes bson.M `bson:"uk"` Lsid interface{} `bson:"lsid"` // mark the session id, used in transaction FromMigrate bool `bson:"fromMigrate"` // move chunk /* * 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
func NewPartialLog ¶
func NewPartialLog(data bson.M) *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.