db

package
v0.0.0-...-af24b05 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 102

Documentation

Overview

Package db implements a simple key-value database. The database is cached in memory and mirrored on disk. It is used to store corpus in syz-manager and syz-hub. The database strives to minimize number of disk accesses as they can be slow in virtualized environments (GCE).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(filename string, version uint64, records []Record) error

Create creates a new database in the specified file with the specified records.

func ReadCorpus

func ReadCorpus(filename string, target *prog.Target) (progs []*prog.Prog, err error)

Types

type DB

type DB struct {
	Version uint64            // arbitrary user version (0 for new database)
	Records map[string]Record // in-memory cache, must not be modified directly
	// contains filtered or unexported fields
}

func Open

func Open(filename string, repair bool) (*DB, error)

Open opens the specified database file. If the database is corrupted and reading failed, then it returns an non-nil db with whatever records were recovered and a non-nil error at the same time.

func (*DB) BumpVersion

func (db *DB) BumpVersion(version uint64) error

func (*DB) Delete

func (db *DB) Delete(key string)

func (*DB) Flush

func (db *DB) Flush() error

func (*DB) Save

func (db *DB) Save(key string, val []byte, seq uint64)

type Record

type Record struct {
	Val []byte
	Seq uint64
}

Jump to

Keyboard shortcuts

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