edge/pkg/storage/driver/rpc/server/share/get_resource.go
William Petit 8e574c299b
All checks were successful
arcad/edge/pipeline/pr-master This commit looks good
feat(storage): rpc based implementation
2023-09-28 12:36:30 -06:00

32 lines
614 B
Go

package share
import (
"context"
"forge.cadoles.com/arcad/edge/pkg/app"
"forge.cadoles.com/arcad/edge/pkg/storage/share"
"github.com/pkg/errors"
)
type GetResourceArgs struct {
Origin app.ID
ResourceID share.ResourceID
}
type GetResourceReply struct {
Resource *SerializableResource
}
func (s *Service) GetResource(ctx context.Context, args GetResourceArgs, reply *GetResourceReply) error {
resource, err := s.store.GetResource(ctx, args.Origin, args.ResourceID)
if err != nil {
return errors.WithStack(err)
}
*reply = GetResourceReply{
Resource: FromResource(resource),
}
return nil
}