mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-16 08:42:57 +00:00
@@ -93,6 +93,30 @@ describe("LanceDB client", function () {
|
||||
const con = await lancedb.connect(uri);
|
||||
assert.deepEqual(await con.tableNames(), ["vectors"]);
|
||||
});
|
||||
|
||||
it("read consistency level", async function () {
|
||||
const uri = await createTestDB();
|
||||
const db1 = await lancedb.connect({ uri });
|
||||
const table1 = await db1.openTable("vectors");
|
||||
|
||||
const db2 = await lancedb.connect({
|
||||
uri,
|
||||
readConsistencyInterval: 0
|
||||
})
|
||||
const table2 = await db2.openTable("vectors");
|
||||
|
||||
assert.equal(await table2.countRows(), 2);
|
||||
await table1.add([
|
||||
{
|
||||
id: 3,
|
||||
name: 'name_2',
|
||||
price: 10,
|
||||
is_active: true,
|
||||
vector: [ 0, 0.1 ]
|
||||
},
|
||||
]);
|
||||
assert.equal(await table2.countRows(), 3);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when querying an existing dataset", function () {
|
||||
|
||||
@@ -49,7 +49,7 @@ fn runtime<'a, C: Context<'a>>(cx: &mut C) -> NeonResult<&'static Runtime> {
|
||||
fn database_new(mut cx: FunctionContext) -> JsResult<JsPromise> {
|
||||
let path = cx.argument::<JsString>(0)?.value(&mut cx);
|
||||
let read_consistency_interval = cx
|
||||
.argument_opt(5)
|
||||
.argument_opt(2)
|
||||
.and_then(|arg| arg.downcast::<JsNumber, _>(&mut cx).ok())
|
||||
.map(|v| v.value(&mut cx))
|
||||
.map(std::time::Duration::from_secs_f64);
|
||||
|
||||
Reference in New Issue
Block a user