Skip to content

[raft/aux] Add aux Raftstore - #1528

Open
MariemBaccari wants to merge 2 commits into
interuss:masterfrom
Orbitalize:add_aux
Open

[raft/aux] Add aux Raftstore#1528
MariemBaccari wants to merge 2 commits into
interuss:masterfrom
Orbitalize:add_aux

Conversation

@MariemBaccari

@MariemBaccari MariemBaccari commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Chained PR: #1622 -> #1528 -> #1626 -> #1597 -> #1623

Implements the aux Raftstore.
Removes the registry as it is not needed by aux which only calls Interact.
Implements the aux repo which calls the consensus instance for each type of operation (except GetDSSAirspaceRepresentationID which is local).

@MariemBaccari
MariemBaccari force-pushed the add_aux branch 3 times, most recently from 235e51e to e9ece61 Compare June 15, 2026 13:44
@MariemBaccari MariemBaccari changed the title [Raft] Add aux stubs [Raft] Add aux Raftstore Jun 15, 2026
Comment thread pkg/aux_/store/raftstore/store.go Outdated
@MariemBaccari
MariemBaccari force-pushed the add_aux branch 2 times, most recently from 9566c32 to 5d13119 Compare June 15, 2026 14:52
@MariemBaccari MariemBaccari changed the title [Raft] Add aux Raftstore [raft/aux] Add aux Raftstore Jun 16, 2026
@MariemBaccari
MariemBaccari force-pushed the add_aux branch 5 times, most recently from 8f85bb5 to 9e8af65 Compare June 16, 2026 09:18
@MariemBaccari
MariemBaccari marked this pull request as ready for review June 16, 2026 09:24
@MariemBaccari
MariemBaccari requested a review from the-glu June 16, 2026 09:24

@the-glu the-glu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

95eb833 LGTM

@mickmis mickmis left a comment

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.

Overall LGTM, but several minor comments

Comment on lines +21 to +26
if locality == "" {
return stacktrace.NewErrorWithCode(dsserr.BadRequest, "Locality not set")
}
if publicEndpoint == "" {
return stacktrace.NewErrorWithCode(dsserr.BadRequest, "Public endpoint not set")
}

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.

Deduplicate this validation (push it in the caller, or factor away in a separate function, or add a validation middleware, or else) (also from memstore, and also for other methods in here).

return stacktrace.Propagate(err, "failed to marshal payload")
}

_, err = r.consensus.HandleClientRequest(ctx, string(saveOwnMetadata), buf, false)

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.

(not for this PR) shouldn't requestType be a type exposed alongside HandleClientRequest?

func (r *repo) Apply(_ context.Context, _ consensus.Proposal) (any, error) {
return nil, stacktrace.NewErrorWithCode(dsserr.NotImplemented, "not implemented yet")
func (r *repo) Apply(ctx context.Context, proposal consensus.Proposal) (any, error) {
memRepo, err := r.memStore.Interact(ctx)

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.

nit: calling Interact here looks like just an unnecessary layer of indirection, since it just returns GetRepo: call GetRepo() directly?

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.

Actually that is making me wonder: do we actually need the memstore abstraction? Don't we only need the memrepo? AKAIU the memstore / memrepo will exclusively be invoked by the raftstore, and never directly by the API layer.
cc @the-glu

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think it cost much to keep the abstraction and to keep everything with the same "layering", so that was on purpose yes.

We probably want at some point make the memstore testable directly, or test the raftstore with others kinds of store.

return p, nil
}

func GetClusterID() uint64 {

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.

Why not calling GetConnectParameters instead?

Comment on lines +16 to +17
Locality string
PublicEndpoint 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.

Out of clarity, please put the json tags on the fields. This makes it explicit this struct is used for that purpose, and also makes it not necessary to expose them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remarks in case of that change it, but we may want to use something else than JSON for future optimizations there.

if err != nil {
return nil, stacktrace.Propagate(err, "failed to propose %s", getDSSMetadata)
}
if result == nil {

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.

Is this necessary? The nil returned from HandleClientRequest is actually typed.

Comment on lines +51 to +52
if _, ok := result.([]*auxmodels.DSSMetadata); !ok {
return nil, stacktrace.NewError("unexpected result type: %T", result)

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.

nit

Suggested change
if _, ok := result.([]*auxmodels.DSSMetadata); !ok {
return nil, stacktrace.NewError("unexpected result type: %T", result)
if res, ok := result.([]*auxmodels.DSSMetadata); ok {
return res, nil

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

Labels

dss-raft Relating to the application-layer consensus implemenation based on raft

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants