Skip to content

Latest commit

 

History

History
111 lines (86 loc) · 2.56 KB

File metadata and controls

111 lines (86 loc) · 2.56 KB
layout default
menu_item api
title Odb
description Version 0.19.0
return_to
API Documentation Index
/api/
sections
open #addDiskAlternate #expandIds #free #read #write STREAM
#open
#addDiskAlternate
#expandIds
#free
#read
#write
#STREAM

Odb.open Async

Odb.open(objects_dir).then(function(odb) {
  // Use odb
});
Parameters Type
objects_dir String path of the backends' "objects" directory.
Returns
Odb

Odb#addDiskAlternate Sync

var result = odb.addDiskAlternate(path);

| Parameters | Type | | --- | --- | --- | | path | String | path to the objects folder for the alternate |

Returns
Number 0 on success; error code otherwise

Odb#expandIds Sync

var result = odb.expandIds(ids, count);

| Parameters | Type | | --- | --- | --- | | ids | OdbExpandId | An array of short object IDs to search for | | count | Number | The length of the ids array |

Returns
Number 0 on success or an error code on failure

Odb#free Sync

odb.free();

Odb#read Async

odb.read(id).then(function(odbObject) {
  // Use odbObject
});

| Parameters | Type | | --- | --- | --- | | id | Oid | identity of the object to read. |

Returns
OdbObject the read object

Odb#write Async

odb.write(data, len, type).then(function(oid) {
  // Use oid
});

| Parameters | Type | | --- | --- | --- | | data | Buffer | buffer with the data to store | | len | Number | size of the buffer | | type | Number | type of the data to store |

Returns
Oid

Odb.STREAM ENUM

| Flag | Value | | --- | --- | --- | | Odb.STREAM.RDONLY | 2 | | Odb.STREAM.WRONLY | 4 | | Odb.STREAM.RW | 6 |