Skip to content

Commit

Permalink
rpc: export function unmarshall universe ID
Browse files Browse the repository at this point in the history
  • Loading branch information
ffranr committed Oct 3, 2023
1 parent c916bbe commit 7125e3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,7 @@ func unmarshalAssetSyncConfig(
error) {

// Parse the universe ID from the RPC form.
uniID, err := unmarshalUniID(config.Id)
uniID, err := UnmarshalUniID(config.Id)
if err != nil {
return nil, fmt.Errorf("unable to parse universe id: %w",
err)
Expand All @@ -2550,8 +2550,8 @@ func unmarshalAssetSyncConfig(
}, nil
}

// unmarshalUniID parses the RPC universe ID into the native counterpart.
func unmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) {
// UnmarshalUniID parses the RPC universe ID into the native counterpart.
func UnmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) {
switch {
case rpcID.GetAssetId() != nil:
var assetID asset.ID
Expand Down Expand Up @@ -2613,7 +2613,7 @@ func unmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) {
func (r *rpcServer) QueryAssetRoots(ctx context.Context,
req *unirpc.AssetRootQuery) (*unirpc.QueryRootResponse, error) {

universeID, err := unmarshalUniID(req.Id)
universeID, err := UnmarshalUniID(req.Id)
if err != nil {
return nil, err
}
Expand All @@ -2640,7 +2640,7 @@ func (r *rpcServer) QueryAssetRoots(ctx context.Context,
func (r *rpcServer) DeleteAssetRoot(ctx context.Context,
req *unirpc.DeleteRootQuery) (*unirpc.DeleteRootResponse, error) {

universeID, err := unmarshalUniID(req.Id)
universeID, err := UnmarshalUniID(req.Id)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -2676,7 +2676,7 @@ func marshalLeafKey(leafKey universe.LeafKey) *unirpc.AssetKey {
func (r *rpcServer) AssetLeafKeys(ctx context.Context,
req *unirpc.ID) (*unirpc.AssetLeafKeyResponse, error) {

universeID, err := unmarshalUniID(req)
universeID, err := UnmarshalUniID(req)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -2738,7 +2738,7 @@ func (r *rpcServer) marshalAssetLeaf(ctx context.Context,
func (r *rpcServer) AssetLeaves(ctx context.Context,
req *unirpc.ID) (*unirpc.AssetLeafResponse, error) {

universeID, err := unmarshalUniID(req)
universeID, err := UnmarshalUniID(req)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -2927,7 +2927,7 @@ func (r *rpcServer) marshalIssuanceProof(ctx context.Context,
func (r *rpcServer) QueryProof(ctx context.Context,
req *unirpc.UniverseKey) (*unirpc.AssetProofResponse, error) {

universeID, err := unmarshalUniID(req.Id)
universeID, err := UnmarshalUniID(req.Id)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -2996,7 +2996,7 @@ func (r *rpcServer) InsertProof(ctx context.Context,
return nil, fmt.Errorf("key cannot be nil")
}

universeID, err := unmarshalUniID(req.Key.Id)
universeID, err := UnmarshalUniID(req.Key.Id)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -3064,7 +3064,7 @@ func unmarshalUniverseSyncType(req unirpc.UniverseSyncMode) (
func unmarshalSyncTargets(targets []*unirpc.SyncTarget) ([]universe.Identifier, error) {
uniIDs := make([]universe.Identifier, 0, len(targets))
for _, target := range targets {
uniID, err := unmarshalUniID(target.Id)
uniID, err := UnmarshalUniID(target.Id)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions universe_rpc_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func unmarshalMerkleSumNode(root *unirpc.MerkleSumNode) mssmt.Node {
func unmarshalUniverseRoot(
root *unirpc.UniverseRoot) (universe.BaseRoot, error) {

id, err := unmarshalUniID(root.Id)
id, err := UnmarshalUniID(root.Id)
if err != nil {
return universe.BaseRoot{}, err
}
Expand All @@ -60,7 +60,7 @@ func unmarshalUniverseRoots(

baseRoots := make([]universe.BaseRoot, 0, len(roots))
for _, root := range roots {
id, err := unmarshalUniID(root.Id)
id, err := UnmarshalUniID(root.Id)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 7125e3a

Please sign in to comment.