Skip to content

Commit

Permalink
fix: lookup in replica returned data
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
  • Loading branch information
vados-cosmonic committed Jun 28, 2024
1 parent fc83170 commit 5462363
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
16 changes: 14 additions & 2 deletions wit/couchbase/subdocument.wit
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ interface subdocument-lookup {
parent-span: option<request-span>,
}

/// Documents that are returned from lookup-in operations on replicas
record lookup-in-replica-document {
/// CAS revision of the document
cas: u64,

/// Whether this document came from a replica server
is-replica: bool,

/// Value that was retrieved
document: document,
}

/// Errors that occur during lookup for an individual subdocument path
variant subdocument-lookup-error {
/// The provided path does not exist in the document
Expand All @@ -70,14 +82,14 @@ interface subdocument-lookup {
id: document-id,
operations: list<lookup-operation>,
options: lookup-options,
) -> result<list<result<document, subdocument-lookup-error>>, lookup-error>;
) -> result<list<result<lookup-in-replica-document, subdocument-lookup-error>>, lookup-error>;

/// Perform a lookup on a particular document from all replica servers
lookup-in-all-replicas: func(
id: document-id,
operations: list<lookup-operation>,
options: lookup-options,
) -> result<list<result<document, subdocument-lookup-error>>, lookup-error>;
) -> result<list<list<result<lookup-in-replica-document, subdocument-lookup-error>>>, lookup-error>;
}

/// Perform sub-document mutation operations on Documents stored in a Couchbase cluster
Expand Down
4 changes: 2 additions & 2 deletions wit/deps.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[couchbase]
path = "couchbase"
sha256 = "b9d4d7505b29d03f4952cf4845195f728070af4de248e8c6a01807879165dd32"
sha512 = "24b8d81c71a4da20f3881a4a5d10a323dfbe73484b471f89514aa05596022bfb3624c05c2eb11600d976fa58d47f7872daaf9f913d74c13dbad272255603304f"
sha256 = "a8948b95226fe1294d0188e16a61e676364bfe0ea1efe3876b3c7b697bc32e62"
sha512 = "ef4aeeb2c5d8ac75e252f6040a42cc2fc9a73ff784bd5c9f0a98b66e6b633e0aabc64bd6f5547a5fdadd074eb2e2b91ae6744cec72a82809b993126382c16860"

[keyvalue]
path = "keyvalue"
Expand Down
16 changes: 14 additions & 2 deletions wit/deps/couchbase/subdocument.wit
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ interface subdocument-lookup {
parent-span: option<request-span>,
}

/// Documents that are returned from lookup-in operations on replicas
record lookup-in-replica-document {
/// CAS revision of the document
cas: u64,

/// Whether this document came from a replica server
is-replica: bool,

/// Value that was retrieved
document: document,
}

/// Errors that occur during lookup for an individual subdocument path
variant subdocument-lookup-error {
/// The provided path does not exist in the document
Expand All @@ -70,14 +82,14 @@ interface subdocument-lookup {
id: document-id,
operations: list<lookup-operation>,
options: lookup-options,
) -> result<list<result<document, subdocument-lookup-error>>, lookup-error>;
) -> result<list<result<lookup-in-replica-document, subdocument-lookup-error>>, lookup-error>;

/// Perform a lookup on a particular document from all replica servers
lookup-in-all-replicas: func(
id: document-id,
operations: list<lookup-operation>,
options: lookup-options,
) -> result<list<result<document, subdocument-lookup-error>>, lookup-error>;
) -> result<list<list<result<lookup-in-replica-document, subdocument-lookup-error>>>, lookup-error>;
}

/// Perform sub-document mutation operations on Documents stored in a Couchbase cluster
Expand Down

0 comments on commit 5462363

Please sign in to comment.