database

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2017 License: GPL-3.0 Imports: 8 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

This section is empty.

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 (*DB) AggregateCollection added in v1.0.0

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

* Name: AggregateCollection * Purpose: Builds collections that are built via aggregation * comments:

func (*DB) CollectionExists added in v1.0.0

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

* Name: CollectionExists * Purpose: Returns true if collection exists in database * comments:

func (*DB) CreateCollection added in v1.0.0

func (d *DB) CreateCollection(name string, indeces []string) string

* Name: createNewCollection * Purpose: Creates a new collection with required indeces * comments:

func (*DB) GetSelectedDB added in v1.0.0

func (d *DB) GetSelectedDB() string

func (*DB) MapReduceCollection added in v1.0.0

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

* Name: mapReduce Collection * Purpose: Builds collections that are built via map reduce * comments:

func (*DB) SelectDB added in v1.0.0

func (d *DB) SelectDB(db string)

type DBMetaInfo

type DBMetaInfo struct {
	ID         bson.ObjectId `bson:"_id,omitempty"` // Ident
	Name       string        `bson:"name"`          // Top level name of the database
	Analyzed   bool          `bson:"analyzed"`      // Has this database been analyzed
	UsingDates bool          `bson:"dates"`         // Whether this db was created with dates enabled
	Version    string        `bson:"version"`       // Rita version at import
}

DBMetaInfo defines some information about the database

type IndexedFile

type IndexedFile struct {
	ID       bson.ObjectId `bson:"_id,omitempty"`
	Path     string        `bson:"filepath"`
	Hash     string        `bson:"hash"`
	Length   int64         `bson:"length"`
	Parsed   int64         `bson:"time_complete"`
	Mod      time.Time     `bson:"modified"`
	Database string        `bson:"database"`
	Date     string        `bson:"date"`
}

IndexedFile retains everything we need to know about a given file

type MetaDBHandle

type MetaDBHandle struct {
	DB string // Database path
	// contains filtered or unexported fields
}

MetaDBHandle exports control for the meta database

func (*MetaDBHandle) AddNewDB

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

AddNewDB adds a new database tot he DBMetaInfo table

func (*MetaDBHandle) DeleteDB added in v1.0.0

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

DeleteDB removes a database managed by RITA

func (*MetaDBHandle) GetAnalyzedDatabases added in v1.0.0

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

GetAnalyzedDatabases builds a list of database names which have been analyzed

func (*MetaDBHandle) GetDBMetaInfo added in v1.0.0

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

GetDBMetaInfo returns a meta db entry

func (*MetaDBHandle) GetDatabases

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

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

func (*MetaDBHandle) GetFiles

func (m *MetaDBHandle) GetFiles() ([]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 (*MetaDBHandle) GetUnAnalyzedDatabases added in v1.0.0

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

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

func (*MetaDBHandle) InsertNewIndexedFiles

func (m *MetaDBHandle) InsertNewIndexedFiles(files []*IndexedFile) []*IndexedFile

InsertNewIndexedFiles updates the files table with all of the new files from a recent walk of the dir structure at the end of the update we return a new array so that the parser knows which files to get to parsing.

func (*MetaDBHandle) MarkDBAnalyzed added in v1.0.0

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

MarkDBAnalyzed marks a database as having been analyzed

func (*MetaDBHandle) MarkFileImported

func (m *MetaDBHandle) MarkFileImported(f *IndexedFile) error

markComplete will mark a file as having been completed in the database

type Resources added in v1.0.0

type Resources struct {
	System *config.SystemConfig
	Log    *log.Logger
	DB     *DB
	MetaDB *MetaDBHandle
}

Resources provides a data structure for passing system Resources

func InitMockResources added in v1.0.0

func InitMockResources(cfgPath string) *Resources

InitResources grabs the configuration file and intitializes the configuration data returning a *Resources object which has all of the necessary configuration information

func InitResources added in v1.0.0

func InitResources(cfgPath string) *Resources

InitResources grabs the configuration file and intitializes the configuration data returning a *Resources object which has all of the necessary configuration information

Jump to

Keyboard shortcuts

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