Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

feat(rebaser): Rebaser uses layerdb activites#3482

Merged
si-bors-ng[bot] merged 1 commit intomainfrom
adamhjk/rebaser-uses-activities
Mar 28, 2024
Merged

feat(rebaser): Rebaser uses layerdb activites#3482
si-bors-ng[bot] merged 1 commit intomainfrom
adamhjk/rebaser-uses-activities

Conversation

@adamhjk
Copy link
Copy Markdown
Contributor

@adamhjk adamhjk commented Mar 28, 2024

This refactors the rebaser to use a layerdb activities stream. Under the hood it uses a NATS Jetstream work queue.

  • Makes subscriptions to activities multiplexed (unless they are a work queue)
  • Adds integration test activities
  • Adds rebase and rebase_and_wait, which waits for a finish event

This refactors the rebaser to use a layerdb activities stream. Under the
hood it uses a NATS Jetstream work queue.

* Makes subscriptions to activities multiplexed (unless they are a work
  queue)
* Adds integration test activities
* Adds rebase and rebase_and_wait, which waits for a finish event
* Removes the rebaser-client crate, which is no longer neccessary
@adamhjk adamhjk force-pushed the adamhjk/rebaser-uses-activities branch from 52f539e to ed2bc7c Compare March 28, 2024 21:20
@adamhjk
Copy link
Copy Markdown
Contributor Author

adamhjk commented Mar 28, 2024

bors merge

Copy link
Copy Markdown
Contributor

@nickgerace nickgerace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread lib/dal/src/context.rs
Comment on lines 1119 to 1123
async fn rebase(
tenancy: &Tenancy,
nats: NatsClient,
rebaser_config: RebaserClientConfig,
layer_db: &DalLayerDb,
rebase_request: RebaseRequest,
) -> Result<Option<Conflicts>, TransactionsError> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dig it!

layer_db.clone(),
);

// Setup the subjects.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splendid

Comment on lines +71 to +72
info!("subscribing to work queue");
let stream = layer_db.activity().rebase().subscribe_work_queue().await?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop-in replacement!

Comment on lines +111 to 118
RebaseStatus::Success {
updates_performed: serde_json::to_value(updates)?.to_string(),
}
} else {
ReplyRebaseMessage::ConflictsFound {
conflicts_found: serde_json::to_value(conflicts)?,
updates_found_and_skipped: serde_json::to_value(updates)?,
RebaseStatus::ConflictsFound {
conflicts_found: serde_json::to_value(conflicts)?.to_string(),
updates_found_and_skipped: serde_json::to_value(updates)?.to_string(),
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the future: potential use concrete types in the response. We might only need Conflicts too.

Comment on lines +75 to +76
// NOTE: We're basically smashing the data in here, and we really do have to figure out what we
// actually want when things work / or don't work.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

Comment on lines +143 to +146
// Why is this in two? We want to start listening before the publish call, to ensure we
// aren't racing with any listening service.
let start = Instant::now();
let rx = self.rebase_finished_activity_stream().await?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

@si-bors-ng
Copy link
Copy Markdown
Contributor

si-bors-ng bot commented Mar 28, 2024

Build succeeded:

@si-bors-ng si-bors-ng bot merged commit 1d0ec39 into main Mar 28, 2024
@si-bors-ng si-bors-ng bot deleted the adamhjk/rebaser-uses-activities branch March 28, 2024 22:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants