Documentation ¶
Overview ¶
Package intents provides utilities for performing dump/restore operations.
Index ¶
- func NewLegacyPrioritizer(intentList []*Intent) *legacyPrioritizer
- func NewLongestTaskFirstPrioritizer(intents []*Intent) *longestTaskFirstPrioritizer
- func NewMultiDatabaseLTFPrioritizer(intents []*Intent) *multiDatabaseLTFPrioritizer
- type BySize
- type DBHeap
- type Intent
- type IntentPrioritizer
- type Manager
- func (manager *Manager) AuthVersion() *Intent
- func (manager *Manager) Finalize(pType PriorityType)
- func (manager *Manager) Finish(intent *Intent)
- func (mgr *Manager) HasConfigDBIntent() bool
- func (manager *Manager) IntentForNamespace(ns string) *Intent
- func (manager *Manager) Intents() []*Intent
- func (manager *Manager) Oplog() *Intent
- func (manager *Manager) Peek() *Intent
- func (manager *Manager) Pop() *Intent
- func (manager *Manager) Put(intent *Intent)
- func (manager *Manager) Roles() *Intent
- func (manager *Manager) SystemIndexDBs() []string
- func (manager *Manager) SystemIndexes(dbName string) *Intent
- func (manager *Manager) UsePrioritizer(prioritizer IntentPrioritizer)
- func (manager *Manager) Users() *Intent
- type PriorityType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLegacyPrioritizer ¶
func NewLegacyPrioritizer(intentList []*Intent) *legacyPrioritizer
func NewLongestTaskFirstPrioritizer ¶
func NewLongestTaskFirstPrioritizer(intents []*Intent) *longestTaskFirstPrioritizer
NewLongestTaskFirstPrioritizer returns an initialized LTP prioritizer
func NewMultiDatabaseLTFPrioritizer ¶
func NewMultiDatabaseLTFPrioritizer(intents []*Intent) *multiDatabaseLTFPrioritizer
NewMultiDatabaseLTFPrioritizer takes in a list of intents and returns an initialized prioritizer.
Types ¶
type DBHeap ¶
type DBHeap []*dbCounter
Returns the largest collection of the databases with the least active restores. Implements the container/heap interface. None of its methods are meant to be called directly.
type Intent ¶
type Intent struct { // Namespace info DB string C string // File locations as absolute paths BSONPath string BSONFile file BSONSize int64 MetadataPath string MetadataFile file // Collection options Options *bson.D // File/collection size, for some prioritizer implementations. // Units don't matter as long as they are consistent for a given use case. Size int64 }
mongorestore first scans the directory to generate a list of all files to restore and what they map to. TODO comments
func (*Intent) IsAuthVersion ¶
func (*Intent) IsSpecialCollection ¶
func (*Intent) IsSystemIndexes ¶
type IntentPrioritizer ¶
IntentPrioritizer encapsulates the logic of scheduling intents for restoration. It can know about which intents are in the process of being restored through the "Finish" hook.
Oplog entries and auth entries are not handled by the prioritizer, as these are special cases handled by the regular mongorestore code.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewIntentManager ¶
func NewIntentManager() *Manager
func (*Manager) AuthVersion ¶
AuthVersion returns the intent of the version collection to restore, a special case
func (*Manager) Finalize ¶
func (manager *Manager) Finalize(pType PriorityType)
Finalize processes the intents for prioritization. Currently only two kinds of prioritizers are supported. No more "Put" operations may be done after finalize is called.
func (*Manager) Finish ¶
Finish tells the prioritizer that mongorestore is done restoring the given collection intent.
func (*Manager) HasConfigDBIntent ¶
HasConfigDBIntent returns a bool indicating if any of the intents refer to the "config" database. This can be used to check for possible unwanted conflicts before restoring to a sharded system.
func (*Manager) IntentForNamespace ¶
func (*Manager) Intents ¶
Intents returns a slice containing all of the intents in the manager. Intents is not thread safe
func (*Manager) Oplog ¶
Oplog returns the intent representing the oplog, which isn't stored with the other intents, because it is dumped and restored in a very different way from other collections.
func (*Manager) Peek ¶
Peek returns a copy of a stored intent from the manager without removing the intent. This method is useful for edge cases that need to look ahead at what collections are in the manager before they are scheduled.
NOTE: There are no guarantees that peek will return a usable intent after Finalize() is called.
func (*Manager) Pop ¶
Pop returns the next available intent from the manager. If the manager is empty, it returns nil. Pop is thread safe.
func (*Manager) Put ¶
Put inserts an intent into the manager. Intents for the same collection are merged together, so that BSON and metadata files for the same collection are returned in the same intent.
func (*Manager) Roles ¶
Roles returns the intent of the user roles collection to restore, a special case
func (*Manager) SystemIndexDBs ¶
SystemIndexes returns the databases for which there are system.indexes
func (*Manager) SystemIndexes ¶
SystemIndexes returns the system.indexes bson for a database
func (*Manager) UsePrioritizer ¶
func (manager *Manager) UsePrioritizer(prioritizer IntentPrioritizer)
type PriorityType ¶
type PriorityType int
const ( Legacy PriorityType = iota LongestTaskFirst MultiDatabaseLTF )