database

package
v2.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2019 License: GPL-3.0 Imports: 11 Imported by: 3 modules, 9 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxMongoDBVersion = semver.Version{
	Major: 3,
	Minor: 7,
	Patch: 0,
}

MaxMongoDBVersion is the upper, exclusive bound on the versions of MongoDB compatible with RITA

View Source
var MinMongoDBVersion = semver.Version{
	Major: 3,
	Minor: 2,
	Patch: 0,
}

MinMongoDBVersion is the lower, inclusive bound on the versions of MongoDB compatible with RITA

Functions

This section is empty.

Types

type DB

type DB struct {
	Session *mgo.Session
	// contains filtered or unexported fields
}

DB is the workhorse container for messing with the database

func NewDB

func NewDB(conf *config.Config, log *log.Logger) (*DB, error)

NewDB constructs a new DB struct

func (*DB) AggregateCollection added in v1.0.0

func (d *DB) AggregateCollection(sourceCollection string,
	session *mgo.Session, pipeline []bson.D) *mgo.Iter

AggregateCollection builds a collection via a MongoDB pipeline

func (*DB) CollectionExists added in v1.0.0

func (d *DB) CollectionExists(table string) bool

CollectionExists returns true if collection exists in the currently selected database

func (*DB) CreateCollection added in v1.0.0

func (d *DB) CreateCollection(name string, indeces []mgo.Index) error

CreateCollection creates a new collection in the currently selected database with the required indeces

func (*DB) GetSelectedDB added in v1.0.0

func (d *DB) GetSelectedDB() string

GetSelectedDB retrieves the currently selected database for analysis

func (*DB) MapReduceCollection added in v1.0.0

func (d *DB) MapReduceCollection(sourceCollection string, job mgo.MapReduce) bool

MapReduceCollection builds collections via javascript map reduce jobs

func (*DB) SelectDB added in v1.0.0

func (d *DB) SelectDB(db string)

SelectDB selects a database for analysis

type DBMetaInfo

type DBMetaInfo struct {
	ID             bson.ObjectId `bson:"_id,omitempty"`   // Ident
	Name           string        `bson:"name"`            // Top level name of the database
	ImportFinished bool          `bson:"import_finished"` // Has this database been entirely imported
	Analyzed       bool          `bson:"analyzed"`        // Has this database been analyzed
	ImportVersion  string        `bson:"import_version"`  // Rita version at import
	AnalyzeVersion string        `bson:"analyze_version"` // Rita version at analyze
}

DBMetaInfo defines some information about the database

type LogInfo added in v1.1.1

type LogInfo struct {
	ID      bson.ObjectId `bson:"_id,omitempty"`   // Ident
	Time    time.Time     `bson:"LastUpdateCheck"` // Top level name of the database
	Message string        `bson:"Message"`         // Top level name of the database
	Version string        `bson:"NewestVersion"`   // Top level name of the database
}

LogInfo defines information about the UpdateChecker log

type MetaDB added in v1.0.2

type MetaDB struct {
	// contains filtered or unexported fields
}

MetaDB exports control for the meta database

func NewMetaDB added in v1.0.2

func NewMetaDB(config *config.Config, dbHandle *mgo.Session,
	log *log.Logger) *MetaDB

NewMetaDB instantiates a new handle for the RITA MetaDatabase

func (*MetaDB) AddNewDB added in v1.0.2

func (m *MetaDB) AddNewDB(name string) error

AddNewDB adds a new database to the DBMetaInfo table

func (*MetaDB) AddParsedFiles added in v1.0.2

func (m *MetaDB) AddParsedFiles(files []*fpt.IndexedFile) error

AddParsedFiles adds indexed files to the files the metaDB using the bulk API

func (*MetaDB) CheckCompatibleAnalyze added in v1.0.2

func (m *MetaDB) CheckCompatibleAnalyze(targetDatabase string) (bool, error)

CheckCompatibleAnalyze checks if a database was analyzed with a version of RITA which is compatible with the running version

func (*MetaDB) CheckCompatibleImport added in v1.0.2

func (m *MetaDB) CheckCompatibleImport(targetDatabase string) (bool, error)

CheckCompatibleImport checks if a database was imported with a version of RITA which is compatible with the running version

func (*MetaDB) DeleteDB added in v1.0.2

func (m *MetaDB) DeleteDB(name string) error

DeleteDB removes a database managed by RITA

func (*MetaDB) GetAnalyzeReadyDatabases added in v1.1.0

func (m *MetaDB) GetAnalyzeReadyDatabases() []string

GetAnalyzeReadyDatabases builds a list of database names which are ready to be analyzed

func (*MetaDB) GetAnalyzedDatabases added in v1.0.2

func (m *MetaDB) GetAnalyzedDatabases() []string

GetAnalyzedDatabases builds a list of database names which have been analyzed

func (*MetaDB) GetDBMetaInfo added in v1.0.2

func (m *MetaDB) GetDBMetaInfo(name string) (DBMetaInfo, error)

GetDBMetaInfo returns a meta db entry. This is the only function which returns DBMetaInfo to code outside of meta.go.

func (*MetaDB) GetDatabases added in v1.0.2

func (m *MetaDB) GetDatabases() []string

GetDatabases returns a list of databases being tracked in metadb or an empty array on failure

func (*MetaDB) GetFiles added in v1.0.2

func (m *MetaDB) GetFiles() ([]fpt.IndexedFile, error)

GetFiles gets a list of all IndexedFile objects in the database if successful return a list of files from the database, in the case of failure return a zero length list of files and generat a log message.

func (*MetaDB) GetUnAnalyzedDatabases added in v1.0.2

func (m *MetaDB) GetUnAnalyzedDatabases() []string

GetUnAnalyzedDatabases builds a list of database names which have yet to be analyzed

func (*MetaDB) LastCheck added in v1.1.1

func (m *MetaDB) LastCheck() (time.Time, semver.Version)

LastCheck returns most recent version check

func (*MetaDB) MarkDBAnalyzed added in v1.0.2

func (m *MetaDB) MarkDBAnalyzed(name string, complete bool) error

MarkDBAnalyzed marks a database as having been analyzed

func (*MetaDB) MarkDBImported added in v1.1.0

func (m *MetaDB) MarkDBImported(name string, complete bool) error

MarkDBImported marks a database as having been completely imported

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL