Documentation
¶
Index ¶
- func ApplyCommonPragmas(db *sql.DB) error
- func CloseBbolt(db *bbolt.DB) error
- func CloseGraph(g *cayley.Handle) error
- func CloseSQL(db *sql.DB) error
- func OpenBbolt(path string, readOnly bool) (*bbolt.DB, error)
- func OpenGraph(path string, existing *cayley.Handle, opts GraphOptions) (*cayley.Handle, error)
- func OpenSQLite(path string, readOnly bool) (*sql.DB, error)
- type GraphOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyCommonPragmas ¶
ApplyCommonPragmas reapplies the standard spuri pragmas to an already-open writable sqlite DB. Useful for events or properties tables opened by other means.
func CloseGraph ¶
CloseGraph is a small helper; real code often does more logging.
func OpenBbolt ¶
OpenBbolt opens a bbolt database (used for the fast cache of blobs + locations). Supports read-only mode for inspection tools. RO opens wait up to 15s on the meta lock so list/show can run while another process holds a write handle (e.g. mid-intake). Write opens still have no bbolt Timeout (can block until the peer releases); lock-wait warnings fire after lockWaitWarnAfter either way.
func OpenGraph ¶
OpenGraph opens (or creates) a Cayley graph backed by bbolt at the given path. If existing is non-nil it is closed first (caller must reassign the result). When ReadOnly=false and the store does not exist it will be initialized. Logs debug info about creation/size using the caller's logger config. Blocks that take longer than lockWaitWarnAfter emit lock-wait warnings.
func OpenSQLite ¶
OpenSQLite opens a sqlite database and applies common pragmas used by spuri (WAL journal, busy timeout, foreign keys). For read-only it uses the URI mode=ro and still sets busy_timeout so concurrent list/show can wait on a writer instead of failing immediately with SQLITE_BUSY. The directory is created if needed. Callers typically keep the returned *sql.DB and are responsible for closing it. First-connection work (PRAGMAs) can block on a writer; lock-wait warnings apply.
Types ¶
type GraphOptions ¶
type GraphOptions struct {
ReadOnly bool
}
GraphOptions controls graph opening behavior.