reliable + ensureordered is now the routingcontext and private route default

This commit is contained in:
Christien Rioux 2024-03-18 20:35:13 -04:00
parent c468d9c850
commit 94ce43f944
7 changed files with 47 additions and 89 deletions

View file

@ -8,8 +8,7 @@ final bogusKey =
TypedKey.fromString("VLD0:qD10lHHPD1_Qr23_Qy-1JnxTht12eaWwENVG_m2v7II");
Future<void> testGetDHTValueUnopened() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
await expectLater(
() async => await rc.getDHTValue(bogusKey, 0, forceRefresh: false),
@ -20,8 +19,7 @@ Future<void> testGetDHTValueUnopened() async {
}
Future<void> testOpenDHTRecordNonexistentNoWriter() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
await expectLater(() async => await rc.openDHTRecord(bogusKey),
throwsA(isA<VeilidAPIException>()));
@ -31,8 +29,7 @@ Future<void> testOpenDHTRecordNonexistentNoWriter() async {
}
Future<void> testCloseDHTRecordNonexistent() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
await expectLater(() async => await rc.closeDHTRecord(bogusKey),
throwsA(isA<VeilidAPIException>()));
@ -42,8 +39,7 @@ Future<void> testCloseDHTRecordNonexistent() async {
}
Future<void> testDeleteDHTRecordNonexistent() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
await expectLater(() async => await rc.deleteDHTRecord(bogusKey),
throwsA(isA<VeilidAPIException>()));
@ -53,8 +49,7 @@ Future<void> testDeleteDHTRecordNonexistent() async {
}
Future<void> testCreateDeleteDHTRecordSimple() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
final rec = await rc.createDHTRecord(const DHTSchema.dflt(oCnt: 1));
await rc.closeDHTRecord(rec.key);
@ -65,8 +60,7 @@ Future<void> testCreateDeleteDHTRecordSimple() async {
}
Future<void> testCreateDeleteDHTRecordNoClose() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
final rec = await rc.createDHTRecord(const DHTSchema.dflt(oCnt: 1));
await rc.deleteDHTRecord(rec.key);
@ -76,8 +70,7 @@ Future<void> testCreateDeleteDHTRecordNoClose() async {
}
Future<void> testGetDHTValueNonexistent() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
final rec = await rc.createDHTRecord(const DHTSchema.dflt(oCnt: 1));
expect(await rc.getDHTValue(rec.key, 0), isNull);
@ -88,8 +81,7 @@ Future<void> testGetDHTValueNonexistent() async {
}
Future<void> testSetGetDHTValue() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
final rec = await rc.createDHTRecord(const DHTSchema.dflt(oCnt: 2));
expect(await rc.setDHTValue(rec.key, 0, utf8.encode("BLAH BLAH BLAH")),
@ -112,8 +104,7 @@ Future<void> testSetGetDHTValue() async {
}
Future<void> testOpenWriterDHTValue() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
var rec = await rc.createDHTRecord(const DHTSchema.dflt(oCnt: 2));
final key = rec.key;
@ -249,11 +240,9 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
// Normally they would not get sent if the set comes from the same target
// as the watch's target
final rcWatch = (await Veilid.instance.routingContext())
.withSequencing(Sequencing.ensureOrdered, closeSelf: true);
final rcSet = (await Veilid.instance.routingContext()).withSafety(
const SafetySelectionUnsafe(sequencing: Sequencing.ensureOrdered),
closeSelf: true);
final rcWatch = await Veilid.instance.routingContext();
final rcSet = await Veilid.instance
.unsafeRoutingContext(sequencing: Sequencing.ensureOrdered);
try {
// Make a DHT record
var rec = await rcWatch.createDHTRecord(const DHTSchema.dflt(oCnt: 10));
@ -360,8 +349,7 @@ Future<void> testWatchDHTValues(Stream<VeilidUpdate> updateStream) async {
}
Future<void> testInspectDHTRecord() async {
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
var rec = await rc.createDHTRecord(const DHTSchema.dflt(oCnt: 2));

View file

@ -55,8 +55,7 @@ Future<void> testAppMessageLoopback(Stream<VeilidUpdate> updateStream) async {
await Veilid.instance.debug("purge routes");
// make a routing context that uses a safety route
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
// make a new local private route
final prl = await Veilid.instance.newPrivateRoute();
@ -97,8 +96,7 @@ Future<void> testAppCallLoopback(Stream<VeilidUpdate> updateStream) async {
await Veilid.instance.debug("purge routes");
// make a routing context that uses a safety route
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
// make a new local private route
final prl = await Veilid.instance.newPrivateRoute();
@ -155,8 +153,7 @@ Future<void> testAppMessageLoopbackBigPackets(
await Veilid.instance.debug("purge routes");
// make a routing context that uses a safety route
final rc = await Veilid.instance
.safeRoutingContext(sequencing: Sequencing.ensureOrdered);
final rc = await Veilid.instance.routingContext();
try {
// make a new local private route
final prl = await Veilid.instance.newPrivateRoute();
@ -220,12 +217,10 @@ Future<void> testAppCallLoopbackBigPackets(
await Veilid.instance.debug("purge routes");
// make a routing context that uses a safety route
final rc = (await Veilid.instance.routingContext())
.withSequencing(Sequencing.ensureOrdered, closeSelf: true);
final rc = await Veilid.instance.routingContext();
try {
// make a new local private route
final prl = await Veilid.instance
.newCustomPrivateRoute(Stability.reliable, Sequencing.ensureOrdered);
final prl = await Veilid.instance.newPrivateRoute();
try {
// import it as a remote route as well so we can send to it
final prr = await Veilid.instance.importRemotePrivateRoute(prl.blob);