Skip to content

Subspace packWithVersionstamp vs pack #12599

@Shibi-bala

Description

@Shibi-bala

Hey, been reading through some code to start using Versionstamps in my code, and I noticed some interesting behavior with the two pack methods.

Subspace#pack throws when there is an incomplete versionstamp in the tuple

and

Subspace#packWithVersionstamp throws when there is no incomplete versionstamp in the Tuple

I ended up doing something like the following, and I saw other people have done the same. Was wondering why the api exists like this rather than having a single pack method that delegates to either of these options. Is there a different pattern I should be using here? Is there a case where you would want to call the pack/packWithVersionstamp method and have the exception get thrown?

  if (tuple.hasIncompleteVersionstamp()) {
      return subspace.packWithVersionstamp(tuple);
  } else {
      return subspace.pack(tuple);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions