admindb

package
v0.0.0-...-299c846 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package admindb handles the admin storage on SQLite3.

Auto Migration

Table schemas will be auto migrated on db opening, that means tables will be automatically created on the first time banshee starts.

Persistence

Users, Rules and Projects are stored on disk in sqlite3, the relation between them is:

User:Project    N:M
Rule:Project    N:1

To get gorm DB handle:

adminDBInstance.DB()

Rules Cache

To access rules faster in detector, rules are cached in memory, in a safemap with RWLock.

To get the rulesCache handle:

adminDBInstance.RulesCache

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {

	// Cache
	RulesCache *rulesCache
	// contains filtered or unexported fields
}

DB handles admin storage.

func Open

func Open(fileName string) (*DB, error)

Open DB by fileName.

func (*DB) Close

func (db *DB) Close() error

Close DB.

func (*DB) DB

func (db *DB) DB() *gorm.DB

DB returns db handle.

Jump to

Keyboard shortcuts

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