feat: persist and dispatch client command input
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/rvbox/rvbox/internal/agentproto"
|
||||
"github.com/rvbox/rvbox/internal/client/spool"
|
||||
"github.com/rvbox/rvbox/internal/domain"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// PersistDispatch admits a server dispatch to the durable spool before any
|
||||
@@ -30,5 +31,9 @@ func PersistDispatch(ctx context.Context, store *spool.Store, session Session, d
|
||||
if immutable == [32]byte{} {
|
||||
return spool.Acceptance{}, errors.New("empty dispatch immutable hash")
|
||||
}
|
||||
return store.AcceptCommand(ctx, spool.Command{IssueUUID: issue, ImmutableSHA256: immutable, Revision: dispatch.GetCommandRevision(), Phase: uint32(rvboxv1.CommandLifecycle_COMMAND_ACCEPTED)}, now)
|
||||
spec, err := proto.MarshalOptions{Deterministic: true}.Marshal(dispatch.GetSpec())
|
||||
if err != nil {
|
||||
return spool.Acceptance{}, err
|
||||
}
|
||||
return store.AcceptCommand(ctx, spool.Command{IssueUUID: issue, ImmutableSHA256: immutable, Revision: dispatch.GetCommandRevision(), Phase: uint32(rvboxv1.CommandLifecycle_COMMAND_ACCEPTED), ExecutionSpec: spec}, now)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user