Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a descriptor of the NeoFS BoltDB location database.
For correct operation, DB must be created using the constructor (New) based on the required parameters and optional components.
After successful creation, DB must be opened through Open call. After successful opening, DB is ready to work through API (until Close call).
Upon completion of work with the DB, it must be closed by Close method.
func New ¶
New creates a new instance of the DB.
Panics if at least one value of the parameters is invalid.
The created DB requires calling the Open method in order to initialize required resources.
func (*DB) Close ¶
Close closes underlying BoltDB instance.
Must not be called before successful Open call.
func (*DB) Get ¶
Put reads the record by key from underlying BoltDB instance.
Returns an error if no record is presented by key in DB.
Must not be called before successful Open call.
func (*DB) Open ¶
Open opens underlying BoltDB instance.
Timeout of BoltDB opening is 3s (only for Linux or Darwin).
Opens BoltDB in read-only mode if DB is read-only.
func (*DB) Put ¶
Put saves the record by key in underlying BoltDB instance.
Country code from key is used for allocating the 1st level buckets. Records are stored in country buckets by location code from key. The records are stored in internal binary JSON format.
Must not be called before successful Open call. Must not be called in read-only mode: behavior is undefined.
type Prm ¶
type Prm struct { // Path to BoltDB file with NeoFS location database. // // Must not be empty. Path string }
Prm groups the required parameters of the DB's constructor.
All values must comply with the requirements imposed on them. Passing incorrect parameter values will result in constructor failure (error or panic depending on the implementation).