Documentation ¶
Overview ¶
Package meta handles the database metadata. The metadata is split into two parts - info and schema. Info is the fast changing stats and indexes, that change with every update. Schema is the slow changing columns and indexes that are changed infrequently.
Index ¶
- func Apply[U applyable](m *Meta, updates []U)
- type Fkey
- type Info
- type InfoHamt
- type MergeResult
- type MergeUpdate
- type Meta
- func (m *Meta) AddView(name, def string) *Meta
- func (m *Meta) AlterCreate(ac *schema.Schema, store *stor.Stor) *Meta
- func (m *Meta) AlterDrop(ad *schema.Schema) *Meta
- func (m *Meta) AlterRename(table string, from, to []string) *Meta
- func (m *Meta) CheckAllMerged()
- func (m *Meta) CheckFkeys(ts *schema.Schema)
- func (m *Meta) Cksum() uint32
- func (m *Meta) CksumData() uint32
- func (m *Meta) Drop(name string) *Meta
- func (m *Meta) Ensure(a *schema.Schema, store *stor.Stor) ([]schema.Index, *Meta)
- func (m *Meta) ForEachInfo(fn func(*Info))
- func (m *Meta) ForEachSchema(fn func(*Schema))
- func (m *Meta) ForEachView(fn func(name, def string))
- func (m *Meta) GetRoInfo(table string) *Info
- func (m *Meta) GetRoSchema(table string) *Schema
- func (m *Meta) GetRwInfo(table string) *Info
- func (m *Meta) GetView(name string) string
- func (m *Meta) LayeredOnto(latest *Meta) *Meta
- func (m *Meta) Merge(table string, nmerge int) MergeUpdate
- func (m *Meta) Mutable() *Meta
- func (m *Meta) Offsets() (schemaOff, infoOff uint64)
- func (m *Meta) Persist(exec func(func() PersistUpdate))
- func (m *Meta) Put(ts *Schema, ti *Info) *Meta
- func (m *Meta) PutNew(ts *Schema, ti *Info, ac *schema.Schema) *Meta
- func (m *Meta) RenameTable(from, to string) *Meta
- func (m *Meta) ResetClock()
- func (m *Meta) SameSchemaAs(m2 *Meta) bool
- func (m *Meta) TouchIndexes(table string) *Meta
- func (m *Meta) TouchTable(table string) *Meta
- func (m *Meta) Write(store *stor.Stor) (schemaOff uint64, infoOff uint64)
- type PersistUpdate
- type SaveResult
- type Schema
- func (*Schema) Hash(key string) uint32
- func (ts *Schema) IsTomb() bool
- func (ts *Schema) Ixspecs(nold int)
- func (ts *Schema) Key() string
- func (ts *Schema) LastMod() int
- func (ts *Schema) SetBestKeys(nold int)
- func (ts *Schema) SetLastMod(mod int)
- func (ts *Schema) SetupIndexes()
- func (ts *Schema) SetupNewIndexes(nold int) []schema.Index
- func (ts *Schema) StorSize() int
- func (ts *Schema) Write(w *stor.Writer)
- type SchemaHamt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Info ¶
type Info struct { Table string Indexes []*index.Overlay Nrows int Size uint64 // contains filtered or unexported fields }
func (*Info) SetLastMod ¶
type MergeResult ¶
type MergeResult = index.MergeResult
type MergeUpdate ¶
type MergeUpdate struct {
// contains filtered or unexported fields
}
func (MergeUpdate) Table ¶
func (mu MergeUpdate) Table() string
type Meta ¶
type Meta struct {
// contains filtered or unexported fields
}
Meta is the schema and info metadata. See also: schema.go - Schema, info.go - Info
func (*Meta) CheckAllMerged ¶
func (m *Meta) CheckAllMerged()
func (*Meta) CheckFkeys ¶
CheckFkeys checks the targets of the foreign keys of a table. It panics on error. It is basically a read-only version of createFkeys.
func (*Meta) Ensure ¶
Ensure returns nil newIdxs if there is nothing more to be done i.e. if there are no new indexes or if there is no data yet.
func (*Meta) ForEachInfo ¶
func (*Meta) ForEachSchema ¶
func (*Meta) ForEachView ¶
func (*Meta) GetRoSchema ¶
func (*Meta) LayeredOnto ¶
LayeredOnto is called by transaction commit inside UpdateState. It layers the mutable ixbuf's from transactions onto the latest/current state and returns a new state. Also, the nrows and size deltas are applied. Note: this does not merge the ixbuf's, that is done later by merge. Nor does it save the changes to disk, that is done later by persist.
func (*Meta) Merge ¶
func (m *Meta) Merge(table string, nmerge int) MergeUpdate
Merge collects the updates which are then applied by Apply. It is called by concur merger. WARNING: must not modify meta.
func (*Meta) Persist ¶
func (m *Meta) Persist(exec func(func() PersistUpdate))
Persist is called by state.Persist to write the index updates. It collects the new btree roots which are then applied by Apply. WARNING: must not modify meta.
func (*Meta) RenameTable ¶
func (*Meta) ResetClock ¶
func (m *Meta) ResetClock()
func (*Meta) SameSchemaAs ¶
func (*Meta) TouchIndexes ¶
TouchIndexes is for tests
type PersistUpdate ¶
type PersistUpdate struct {
// contains filtered or unexported fields
}
func (PersistUpdate) Table ¶
func (pu PersistUpdate) Table() string
type SaveResult ¶
type SaveResult = index.SaveResult
type Schema ¶
func (*Schema) Ixspecs ¶
Ixspecs sets up the ixspecs for a table's indexes. In most cases newIdxs will be ts.Indexes.
func (*Schema) SetBestKeys ¶
SetBestKeys determines the BestKey for each index that requires the fewest additional columns. This should be done before IxSpecs. WARNING: this affects the stored index entries so it should only be used for empty indexes.
func (*Schema) SetLastMod ¶
func (*Schema) SetupIndexes ¶
func (ts *Schema) SetupIndexes()
func (*Schema) SetupNewIndexes ¶
SetupNewIndexes sets BestKey and creates Ixspecs.