This is for when the user wants to delete or otherwise reclaim your database's resources.
Parameters
callback: (err: any) => void
public del(key: string, callback: (err: any) => void)
Remove an object or ref from the database.
Parameters
key: string
callback: (err: any) => void
public get(key: string, callback: (err: any, value: any) => void)
Load a ref or object from the database.
The database should assume that keys that are 40-character long hex strings are sha1 hashes. The value for these will always be binary (Buffer in node, Uint8Array in browser) All other keys are paths like refs/heads/master or HEAD and the value is a string.
Parameters
key: string
callback: (err: any, value: any) => void
public has(key: string, callback: (err: any, hasKey: boolean) => void)
Check if a key is in the database
Parameters
key: string
callback: (err: any, hasKey: boolean) => void
public init(callback: (err: any) => void)
Initialize a database. This is where you db implementation can setup stuff.
Parameters
callback: (err: any) => void
public keys(prefix: string, callback: (err: any, keys: string[]) => void)
Given a path prefix, give all the keys. This is like a readdir if you treat the keys as paths.
For example, given the keys refs/heads/master, refs/heads/experimental, refs/tags/0.1.3 and the prefix refs/heads/, the output would be master and experimental.
A null prefix returns all non hash keys.
Parameters
prefix: string
callback: (err: any, keys: string[]) => void
public set(key: string, value: any, callback: (err: any) => void)
Save a value to the database. Same rules apply about hash keys being binary values and other keys being string values.