Documentation ¶
Index ¶
Constants ¶
const FossilDBVersion = 2
FossilDBVersion is the version of the database as recorded on disk. This is primarily used for migration.
const IndexSize int = 100
const SegmentSize int = 10000
Variables ¶
This section is empty.
Functions ¶
func MigrateDatabaseIfNeeded ¶ added in v0.2.0
MigrateDatabaseIfNeeded has all the logic necessary to migrate from an old database through an arbitrary number of versions to the current database version. It does this through use of 3 types of handler functions:
A deserialization function, specific to a source DB version. This function is responsible for reading the on-disk structure of a specific database format.
Some number of migration functions. Migration functions map from version n - 1 -> n, so each function will be called in succession, passing the results of the previous migration.
A cleanup function, specific to a source DB version. This function is responsible for cleaning up any un-needed files after migration.
Types ¶
type Database ¶
type Database struct { Version uint32 Segments []Segment Current uint32 TopicLookup []string SchemaLookup []schema.Object TopicCount int STime time.Time // Last serialize time Name string // <-- We do not save to disk, starting here Path string // contains filtered or unexported fields }
func NewDatabase ¶
NewDatabase creates a new database object in memory and creates the directory and files on disk for storing the data location is the base directory for creating the database
func (*Database) Retrieve ¶
Retrieve a list of datum from the database matching some query TODO: Eventually, this should return a proper result set
func (*Database) SchemaForTopic ¶ added in v0.2.0
type Entry ¶
type Entry struct { Time time.Time `json:"time"` Topic string `json:"topic"` Schema string `json:"schema"` Data []byte `json:"data"` }
An Entry is a hydrated Datum, where the time and topic have been expanded.
func ParseEntry ¶
type Query ¶
type Query struct { Quantifier string Topics []string Range *TimeRange // nil means entire history (no time range) RangeSemantics string // none, before, since, between }
The Query object represents a single query on a database. It contains the 4 main variables of a query:
- Quantifier
- Topic(s)
- Time Range
- Data Predicate (TODO!)
type Result ¶
type Result struct {
Data Entries
}
Result wraps a slice of Items. TODO: Track query statistics and the like in here
type WriteAheadLog ¶
type WriteAheadLog struct {
LogPath string
}
func (*WriteAheadLog) AddEvent ¶
func (w *WriteAheadLog) AddEvent(d *Datum)
func (*WriteAheadLog) AddSegment ¶
func (w *WriteAheadLog) AddSegment(t time.Time)
func (*WriteAheadLog) AddTopic ¶
func (w *WriteAheadLog) AddTopic(t string, s string)
func (*WriteAheadLog) ApplyToDB ¶
func (w *WriteAheadLog) ApplyToDB(d *Database)