Skip to content

A few changes to the RPC methods for ActorSnapshot/ActorSnapshotTag. - #914

Open
Julian Gutierrez Oschmann (juli4n) wants to merge 1 commit into
agent-substrate:mainfrom
juli4n:snapshot_api
Open

A few changes to the RPC methods for ActorSnapshot/ActorSnapshotTag.#914
Julian Gutierrez Oschmann (juli4n) wants to merge 1 commit into
agent-substrate:mainfrom
juli4n:snapshot_api

Conversation

@juli4n

Copy link
Copy Markdown
Collaborator
  • Remove the ActorSnapshotRef message.
  • Add a GetActorSnapshotTag method for the ActorSnapshotTag resource. The request should (as all Get requests) have a single ObjectRef tag field.
  • Change GetActorSnapshotRequest to have a single ObjectRef snapshot field.
  • Add a new field to Actor, called source_snapshot, which the following schema:
message ActorSnapshotSource {
  // If specified, the actor will fork from this snapshot on the first resume.
  // Immutable.
  ObjectRef tag = 1;

  // A reference to the snapshot the tag resolved to at creation time.
  // Output only.
  ObjectRef snapshot = 2;

  // UID of the snapshot the tag resolved to at creation time.
  // Output only.
  string snapshot_uid = 3;
}

See #912 for a more detailed description of the rationale for this change. Fixes #912

Actor actor = 1;

// Optional durable snapshot used to initialize the Actor.
ActorSnapshotRef source_snapshot = 2;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see, we removed it here because the field is now in Actor itself. 👍🏼


resp, err := client.TagActorSnapshot(ctx, &ateapipb.TagActorSnapshotRequest{
Snapshot: &ateapipb.ActorSnapshotRef{Reference: &ateapipb.ActorSnapshotRef_Snapshot{Snapshot: &ateapipb.ObjectRef{Atespace: createTagAtespaceFlag, Name: createTagSnapshotFlag}}},
Snapshot: &ateapipb.ObjectRef{Atespace: createTagAtespaceFlag, Name: createTagSnapshotFlag},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we want the request to specify a atespace, or should the server always assign the tag the same atespace as the Snapshot itself?

lock, snapshot, canonical, tag, err := s.lockActorSnapshot(ctx, ref)
var sourceSnapshotInfo *ateapipb.ActorSnapshotSource
if src := in.GetSourceSnapshot(); src != nil {
lock, snapshot, canonical, tag, err := s.lockActorSnapshot(ctx, nil, src.GetTag())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: do we want to separate lockActorSnapshot to both a GetActorSnapshot and a LockActorSnapshot?

func (s *Service) lockActorSnapshot(ctx context.Context, ref *ateapipb.ActorSnapshotRef) (*store.Lock, *ateapipb.ActorSnapshot, *ateapipb.ObjectRef, *ateapipb.ActorSnapshotTag, error) {
_, canonical, _, err := s.getActorSnapshot(ctx, ref)
// lockActorSnapshot resolves and locks a snapshot by its canonical identity
// or by tag. Exactly one of canonical or tag must be set.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Exactly one of canonical or tag must be set.

Add a check for this to return error if both are set?

// The tag specified by the caller at CreateActor.
ObjectRef tag = 1;

// Output only. Canonical (atespace, name) of the snapshot the tag

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also probably out of scope for this PR: I'm curious why this is output only? Why a snapshot must be tagged before we can use it in CreateActor()?

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.

Revisit ActorSnapshot/ActorSnapshotTag gRPC methods

2 participants