Skip to content

[Raft] Add Raft store stubs#1451

Open
MariemBaccari wants to merge 16 commits intointeruss:masterfrom
Orbitalize:add_raftstore_stubs
Open

[Raft] Add Raft store stubs#1451
MariemBaccari wants to merge 16 commits intointeruss:masterfrom
Orbitalize:add_raftstore_stubs

Conversation

@MariemBaccari
Copy link
Copy Markdown
Contributor

This PR adds Raft store scd stubs to prepare for the incoming implementation.
Since rid and aux will not initially be supported, it skips them.

@MariemBaccari MariemBaccari marked this pull request as draft April 29, 2026 12:18
@MariemBaccari MariemBaccari marked this pull request as ready for review April 29, 2026 14:26
Copy link
Copy Markdown
Contributor

@the-glu the-glu left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, a few suggestions based on the store architecture.

Comment thread cmds/core-service/main.go Outdated
if err != nil {
return stacktrace.Propagate(err, "Failed to create remote ID server")
// Initialize aux and remote ID if implemented by the store
if params.GetStoreParameters().StoreType != params.RaftStoreType {
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 would not have explicit references to store type here: the code in that file should not initialize aux/rid/scd server iff it didn't get a store, but it's the responsibility of the store interface behind to use the params and to return (or not) a store based on them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I addressed this by using a stacktrace error code to detect unsupported store types instead. Does that seem reasonable ?

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.

Yes thanks, just added a comment about normalization.

Comment thread pkg/store/params/params.go Outdated
Comment thread pkg/store/params/params.go Outdated
Comment thread pkg/scd/store/raftstore/store.go Outdated
@MariemBaccari MariemBaccari marked this pull request as draft April 30, 2026 12:53
@MariemBaccari MariemBaccari marked this pull request as ready for review May 4, 2026 17:10
@MariemBaccari MariemBaccari requested a review from the-glu May 4, 2026 17:10
Copy link
Copy Markdown
Contributor

@the-glu the-glu left a comment

Choose a reason for hiding this comment

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

LGTM, Just a small fix for scd's CodeUnsupported normalization.

Comment thread pkg/raftstore/store.go Outdated
panic("not implemented")
}

// Interact returns a read-only repository that can be used to query the store without proposing a Raft entry.
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.

Just for info: there are a few cases when interact() is used in RW mode, but that in RID&aux

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I fixed the comment, thanks

Comment thread cmds/core-service/main.go
Comment thread cmds/core-service/main.go Outdated
// Initialize aux
auxV1Server, err = createAuxServer(ctx, locality, *publicEndpoint, *scdGlobalLock, logger)
if err != nil {
if stacktrace.GetCode(err) == store.CodeUnsupported {
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.

No special handling should be required here. I think it is fine to let the error bubble up and return a 500 (or better, 501*) if they are invoked.
Alternatively, if we want to not register some endpoints, this should be made possible explictly through some config flags (just like the one for scd).

  • IMO the tool openapi-to-go-server should be adding auto-generated 501 responses in the generated models. Then we could wire the handlers so that a dsserr.NotImplemented` maps to a HTTP 501. But that's not within the scope of this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since rid and aux won't be implemented in the first stages of Raft store integration, removing the special handling here will prevent the core-service from starting with just scd. If we add stub rid and aux interfaces, the initialization will fail due to Interact and SaveOwnMetadata not being implemented.

On the other hand, implementing new config flags is invasive considering that rid and aux will be implemented eventually so we will have a temporary config change.

Could you specify which alternative you had in mind ? I'm not sure how to go about this.

Comment thread pkg/store/store.go Outdated
Comment thread pkg/scd/store/raftstore/subscriptions.go Outdated
@MariemBaccari MariemBaccari requested a review from mickmis May 5, 2026 12:02
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.

3 participants