Documentation ¶
Overview ¶
Package bsonidgenerator provides tools for generating sequences of bson ObjectIds for use in test fixtures.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNMachinesTooLarge = fmt.Errorf("Can only manage up to %d unique machines", 1<<24) ErrNItemsPerProcessTooLarge = fmt.Errorf("Can only manage up to %d items per process", 1<<24) )
Functions ¶
func CreateObjectId ¶
Create a bson ObjectId from the set of primitives needed to seed its state. Originally from: http://bazaar.launchpad.net/+branch/mgo/v2/view/head:/bson/bson.go#L218
Types ¶
type Config ¶
type Config struct { Time time.Time // We only use down to the seconds Nmachines uint32 // Holds 4 bytes, we only need 3 NprocessesPerMachine uint16 // Holds 2 bytes, we need 2 NitemsPerProcess uint32 // Holds 4 bytes, we only need 3 }
func NewGenerator ¶
func (Config) Generate ¶
Creates object ids using the Config, placing them in a slice. Returns an error if the configuration doesn't validate.
func (Config) SendOnChannel ¶
Generate a stream of object ids using the Config. Returns an error if the configuration doesn't validate. This function closes the channel when it has finished sending.
Click to show internal directories.
Click to hide internal directories.