Documentation ¶
Index ¶
- type DB
- func (d *DB) AggregateCollection(source_collection_name string, session *mgo.Session, pipeline []bson.D) *mgo.Iter
- func (d *DB) CollectionExists(table string) bool
- func (d *DB) CreateCollection(name string, indeces []string) string
- func (d *DB) GetSelectedDB() string
- func (d *DB) MapReduceCollection(source_collection_name string, job mgo.MapReduce) bool
- func (d *DB) SelectDB(db string)
- type DBMetaInfo
- type IndexedFile
- type MetaDBHandle
- func (m *MetaDBHandle) AddNewDB(name string) error
- func (m *MetaDBHandle) DeleteDB(name string) error
- func (m *MetaDBHandle) GetAnalyzedDatabases() []string
- func (m *MetaDBHandle) GetDBMetaInfo(name string) (DBMetaInfo, error)
- func (m *MetaDBHandle) GetDatabases() []string
- func (m *MetaDBHandle) GetFiles() ([]IndexedFile, error)
- func (m *MetaDBHandle) GetUnAnalyzedDatabases() []string
- func (m *MetaDBHandle) InsertNewIndexedFiles(files []*IndexedFile) []*IndexedFile
- func (m *MetaDBHandle) MarkDBAnalyzed(name string, complete bool) error
- func (m *MetaDBHandle) MarkFileImported(f *IndexedFile) error
- type Resources
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
* Name: CollectionExists * Purpose: Returns true if collection exists in database * comments:
func (*DB) CreateCollection ¶ added in v1.0.0
* Name: createNewCollection * Purpose: Creates a new collection with required indeces * comments:
func (*DB) GetSelectedDB ¶ added in v1.0.0
func (*DB) MapReduceCollection ¶ added in v1.0.0
* Name: mapReduce Collection * Purpose: Builds collections that are built via map reduce * comments:
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
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
InitResources grabs the configuration file and intitializes the configuration data returning a *Resources object which has all of the necessary configuration information