Skip to content

[ADDED] Added support for cross-domain Object Store#1810

Open
albertog-ap wants to merge 2 commits intonats-io:mainfrom
albertog-ap:main
Open

[ADDED] Added support for cross-domain Object Store#1810
albertog-ap wants to merge 2 commits intonats-io:mainfrom
albertog-ap:main

Conversation

@albertog-ap
Copy link
Copy Markdown

Hi!

I have been recently trying to build a simple hub-spoke leaf node setup with a single account and different jetstream domains. Each spoke has its own object store with a limited TTL that i want to use as a staging area and the hub should have complete control over them.

These object stores must reside on the spokes because they must be available even if the connection to the hub is severed. There should also be no cross-talk between spokes, as well as as limited access from the spoke to the hub, and I managed to achieve that with different users and a scoped signing key.

However when i tried to operate the object stores form the hub, i noticed that the requests where timing out. A quick search got me to #1648 which correctly identifies the issue: chunk subjects do not use domains (and by extension any jetstream api prefix) and therefore cannot cross jetstream boundaries.

This pull request solves the issue by adding the jetstream API prefix to the $O.> subjects. I took inspiration from the nats.java fixes in nats-io/nats.java#1160 and nats-io/nats.java#1172

There still one thing missing though: a new mapping must be manually esablished on the spokes. For example:

mappings {
    '$JS.LEAF.API.$O.>': '$O.>'
}

Usually the nats server does behind the scene mappings when setting up jetstream domains (see server/jetstream_api.go#331 ). IMO a change should be made to add a default mapping for the $O.> subjects too to provide this functionality out of the box.

I fixed both the new and old jetstream API and added tests for both.

Since this is my first contribution, please let me know if I did everything correctly!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant