feat: add QueryActivatedTrustAnchorCount

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2024-07-22 01:33:10 +02:00
parent 064e7c1b38
commit 66f4dec01b
No known key found for this signature in database
GPG Key ID: FA5EE906EB55316A
10 changed files with 567 additions and 49 deletions

View File

@ -47505,6 +47505,39 @@ paths:
type: boolean
tags:
- Query
/planetmint/machine/activated_trust_anchor_count:
get:
summary: Queries a list of ActivatedTrustAnchorCount items.
operationId: PlanetmintgoMachineActivatedTrustAnchorCount
responses:
'200':
description: A successful response.
schema:
type: object
properties:
count:
type: string
format: uint64
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
tags:
- Query
/planetmint/machine/address/{address}:
get:
summary: Queries a list of GetMachineByAddress items.
@ -77197,6 +77230,12 @@ definitions:
dao_machine_funding_denom:
type: string
description: Params defines the parameters for the module.
planetmintgo.machine.QueryActivatedTrustAnchorCountResponse:
type: object
properties:
count:
type: string
format: uint64
planetmintgo.machine.QueryGetLiquidAssetsByMachineidResponse:
type: object
properties:

View File

@ -43,6 +43,12 @@ service Query {
option (google.api.http).get = "/planetmint/machine/liquid_assets/{machineID}";
}
// Queries a list of ActivatedTrustAnchorCount items.
rpc ActivatedTrustAnchorCount (QueryActivatedTrustAnchorCountRequest) returns (QueryActivatedTrustAnchorCountResponse) {
option (google.api.http).get = "/planetmint/machine/activated_trust_anchor_count";
}
}
// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}
@ -87,3 +93,9 @@ message QueryGetLiquidAssetsByMachineidResponse {
LiquidAsset liquidAssetEntry = 1;
}
message QueryActivatedTrustAnchorCountRequest {}
message QueryActivatedTrustAnchorCountResponse {
uint64 count = 1;
}

View File

@ -32,6 +32,8 @@ func GetQueryCmd(_ string) *cobra.Command {
cmd.AddCommand(CmdGetLiquidAssetsByMachineid())
cmd.AddCommand(CmdActivatedTrustAnchorCount())
// this line is used by starport scaffolding # 1
return cmd

View File

@ -0,0 +1,42 @@
package cli
import (
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/planetmint/planetmint-go/x/machine/types"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdActivatedTrustAnchorCount() *cobra.Command {
cmd := &cobra.Command{
Use: "activated-trust-anchor-count",
Short: "Query activated-trust-anchor-count",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryActivatedTrustAnchorCountRequest{}
res, err := queryClient.ActivatedTrustAnchorCount(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

View File

@ -0,0 +1,21 @@
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/machine/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) ActivatedTrustAnchorCount(goCtx context.Context, req *types.QueryActivatedTrustAnchorCountRequest) (*types.QueryActivatedTrustAnchorCountResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
count := k.GetActivatedTACount(ctx)
return &types.QueryActivatedTrustAnchorCountResponse{Count: count}, nil
}

View File

@ -0,0 +1,19 @@
package keeper_test
import (
"testing"
sdk "github.com/cosmos/cosmos-sdk/types"
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
"github.com/planetmint/planetmint-go/x/machine/types"
"github.com/stretchr/testify/assert"
)
func TestActivatedTrustAnchorCount(t *testing.T) {
keeper, ctx := keepertest.MachineKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
createNTrustAnchor(t, keeper, ctx, 100)
response, err := keeper.ActivatedTrustAnchorCount(wctx, &types.QueryActivatedTrustAnchorCountRequest{})
assert.NoError(t, err)
assert.Equal(t, uint64(50), response.Count)
}

View File

@ -17,8 +17,8 @@ func (k Keeper) StoreTrustAnchor(ctx sdk.Context, ta types.TrustAnchor, activate
var appendValue []byte
if activated {
appendValue = []byte{1}
counter := k.GetActivatedTACounter(ctx)
k.setActivatedTACounter(ctx, counter+1)
counter := k.GetActivatedTACount(ctx)
k.setActivatedTACount(ctx, counter+1)
} else {
appendValue = []byte{0}
}
@ -50,14 +50,14 @@ func (k Keeper) GetTrustAnchor(ctx sdk.Context, pubKey string) (val types.TrustA
return val, false, true
}
func (k Keeper) setActivatedTACounter(ctx sdk.Context, counter uint64) {
func (k Keeper) setActivatedTACount(ctx sdk.Context, counter uint64) {
taCounterStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TAIndexKey))
bz := make([]byte, 8)
binary.BigEndian.PutUint64(bz, counter)
taCounterStore.Set([]byte(types.ActivatedTACounterKey), bz)
}
func (k Keeper) GetActivatedTACounter(ctx sdk.Context) (counter uint64) {
func (k Keeper) GetActivatedTACount(ctx sdk.Context) (counter uint64) {
taCounterStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TAIndexKey))
bz := taCounterStore.Get([]byte(types.ActivatedTACounterKey))
if bz == nil {

View File

@ -74,6 +74,6 @@ func TestActivatedTACounter(t *testing.T) {
t.Parallel()
keeper, ctx := keepertest.MachineKeeper(t)
createNTrustAnchor(t, keeper, ctx, 100)
counter := keeper.GetActivatedTACounter(ctx)
counter := keeper.GetActivatedTACount(ctx)
assert.Equal(t, uint64(50), counter)
}

View File

@ -477,6 +477,88 @@ func (m *QueryGetLiquidAssetsByMachineidResponse) GetLiquidAssetEntry() *LiquidA
return nil
}
type QueryActivatedTrustAnchorCountRequest struct {
}
func (m *QueryActivatedTrustAnchorCountRequest) Reset() { *m = QueryActivatedTrustAnchorCountRequest{} }
func (m *QueryActivatedTrustAnchorCountRequest) String() string { return proto.CompactTextString(m) }
func (*QueryActivatedTrustAnchorCountRequest) ProtoMessage() {}
func (*QueryActivatedTrustAnchorCountRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_bf7841d43d757203, []int{10}
}
func (m *QueryActivatedTrustAnchorCountRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryActivatedTrustAnchorCountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryActivatedTrustAnchorCountRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryActivatedTrustAnchorCountRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryActivatedTrustAnchorCountRequest.Merge(m, src)
}
func (m *QueryActivatedTrustAnchorCountRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryActivatedTrustAnchorCountRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryActivatedTrustAnchorCountRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryActivatedTrustAnchorCountRequest proto.InternalMessageInfo
type QueryActivatedTrustAnchorCountResponse struct {
Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
}
func (m *QueryActivatedTrustAnchorCountResponse) Reset() {
*m = QueryActivatedTrustAnchorCountResponse{}
}
func (m *QueryActivatedTrustAnchorCountResponse) String() string { return proto.CompactTextString(m) }
func (*QueryActivatedTrustAnchorCountResponse) ProtoMessage() {}
func (*QueryActivatedTrustAnchorCountResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_bf7841d43d757203, []int{11}
}
func (m *QueryActivatedTrustAnchorCountResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryActivatedTrustAnchorCountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryActivatedTrustAnchorCountResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryActivatedTrustAnchorCountResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryActivatedTrustAnchorCountResponse.Merge(m, src)
}
func (m *QueryActivatedTrustAnchorCountResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryActivatedTrustAnchorCountResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryActivatedTrustAnchorCountResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryActivatedTrustAnchorCountResponse proto.InternalMessageInfo
func (m *QueryActivatedTrustAnchorCountResponse) GetCount() uint64 {
if m != nil {
return m.Count
}
return 0
}
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.machine.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.machine.QueryParamsResponse")
@ -488,55 +570,62 @@ func init() {
proto.RegisterType((*QueryGetMachineByAddressResponse)(nil), "planetmintgo.machine.QueryGetMachineByAddressResponse")
proto.RegisterType((*QueryGetLiquidAssetsByMachineidRequest)(nil), "planetmintgo.machine.QueryGetLiquidAssetsByMachineidRequest")
proto.RegisterType((*QueryGetLiquidAssetsByMachineidResponse)(nil), "planetmintgo.machine.QueryGetLiquidAssetsByMachineidResponse")
proto.RegisterType((*QueryActivatedTrustAnchorCountRequest)(nil), "planetmintgo.machine.QueryActivatedTrustAnchorCountRequest")
proto.RegisterType((*QueryActivatedTrustAnchorCountResponse)(nil), "planetmintgo.machine.QueryActivatedTrustAnchorCountResponse")
}
func init() { proto.RegisterFile("planetmintgo/machine/query.proto", fileDescriptor_bf7841d43d757203) }
var fileDescriptor_bf7841d43d757203 = []byte{
// 688 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xc1, 0x4f, 0x13, 0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xab, 0xd2, 0xf4, 0x0c, 0x0b, 0x6a,
0x86, 0x59, 0x78, 0xcb, 0x34, 0x83, 0x0e, 0x38, 0x3e, 0xd4, 0x87, 0x1e, 0x3c, 0xb6, 0x80, 0x7d,
0x71, 0x82, 0xe0, 0x83, 0x7c, 0x17, 0xf9, 0x01, 0xb6, 0x1f, 0xfe, 0x25, 0x5b, 0x8f, 0xb2, 0xa2,
0x46, 0xc1, 0x70, 0xc1, 0x34, 0x4a, 0xf6, 0x2b, 0x95, 0xbe, 0x88, 0xcd, 0x8d, 0x5e, 0xbd, 0x71,
0x74, 0x52, 0xb6, 0x8e, 0x4f, 0xca, 0xd6, 0xcf, 0x93, 0xb2, 0xf5, 0xe1, 0xb4, 0x5c, 0x38, 0x3e,
0x2d, 0x17, 0xbe, 0x9f, 0x96, 0x0b, 0xaf, 0x96, 0x5d, 0x26, 0x77, 0xc3, 0x56, 0xd5, 0xe1, 0xdd,
0xac, 0x64, 0x7a, 0x5c, 0x70, 0x39, 0x3e, 0x48, 0xdf, 0x78, 0xe4, 0x53, 0xd1, 0x1a, 0x55, 0x9f,
0xc0, 0xe5, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x54, 0x57, 0xb2, 0xca, 0x0c, 0x08, 0x00, 0x00,
// 759 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x4f, 0x13, 0x4f,
0x18, 0xee, 0x12, 0xfe, 0x0e, 0x97, 0x5f, 0x86, 0xfe, 0x12, 0xdc, 0xd4, 0x52, 0x26, 0xc1, 0x22,
0x91, 0x8e, 0x94, 0xf0, 0x27, 0x82, 0xc6, 0x56, 0xd4, 0x10, 0x6d, 0x02, 0xd5, 0x93, 0xc6, 0x34,
0xd3, 0xed, 0x64, 0xd9, 0xd8, 0xee, 0x2c, 0x9d, 0x59, 0x42, 0x43, 0x38, 0xe8, 0x27, 0x30, 0xf1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, 0xd1, 0x79, 0x50, 0x9b, 0x04, 0x1f, 0xa8,
0x87, 0x43, 0x78, 0x6c, 0x00, 0xf3, 0xe2, 0x51, 0x85, 0xeb, 0xc9, 0x2a, 0x92, 0x37, 0x85, 0xf9,
0xf0, 0x86, 0x6c, 0x65, 0x65, 0x49, 0x5a, 0xc1, 0x70, 0x5e, 0x67, 0x25, 0xfe, 0x73, 0x18, 0x1d,
0xc4, 0xe6, 0x86, 0xb4, 0x74, 0xeb, 0xc2, 0xd1, 0x86, 0x6b, 0x09, 0x9a, 0x2e, 0xdb, 0x1c, 0xe6,
0xfa, 0xcd, 0xc8, 0xca, 0xcf, 0xaa, 0xf4, 0x53, 0x84, 0xf7, 0xb5, 0x47, 0x13, 0xd2, 0x6b, 0xf1,
0x8b, 0x56, 0x93, 0x1b, 0xa7, 0x5c, 0x39, 0x3a, 0xc9, 0x1a, 0xc7, 0x27, 0x59, 0xe3, 0xd7, 0x49,
0xd6, 0xf8, 0x74, 0x9a, 0x4d, 0x1d, 0x9f, 0x66, 0x53, 0x3f, 0x4e, 0xb3, 0xa9, 0x37, 0x8b, 0xb6,
0x23, 0x76, 0xfc, 0x7a, 0xc1, 0x62, 0xad, 0x78, 0xd6, 0xe8, 0x71, 0xde, 0x66, 0x78, 0x3f, 0xba,
0xc4, 0x1d, 0x8f, 0xf2, 0xfa, 0xb0, 0xfc, 0xfb, 0xb0, 0xf8, 0x37, 0x00, 0x00, 0xff, 0xff, 0x84,
0x0f, 0x24, 0xf7, 0x48, 0x09, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -561,6 +650,8 @@ type QueryClient interface {
GetMachineByAddress(ctx context.Context, in *QueryGetMachineByAddressRequest, opts ...grpc.CallOption) (*QueryGetMachineByAddressResponse, error)
// Queries a list of GetLiquidAssetsByMachineid items.
GetLiquidAssetsByMachineid(ctx context.Context, in *QueryGetLiquidAssetsByMachineidRequest, opts ...grpc.CallOption) (*QueryGetLiquidAssetsByMachineidResponse, error)
// Queries a list of ActivatedTrustAnchorCount items.
ActivatedTrustAnchorCount(ctx context.Context, in *QueryActivatedTrustAnchorCountRequest, opts ...grpc.CallOption) (*QueryActivatedTrustAnchorCountResponse, error)
}
type queryClient struct {
@ -616,6 +707,15 @@ func (c *queryClient) GetLiquidAssetsByMachineid(ctx context.Context, in *QueryG
return out, nil
}
func (c *queryClient) ActivatedTrustAnchorCount(ctx context.Context, in *QueryActivatedTrustAnchorCountRequest, opts ...grpc.CallOption) (*QueryActivatedTrustAnchorCountResponse, error) {
out := new(QueryActivatedTrustAnchorCountResponse)
err := c.cc.Invoke(ctx, "/planetmintgo.machine.Query/ActivatedTrustAnchorCount", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Parameters queries the parameters of the module.
@ -628,6 +728,8 @@ type QueryServer interface {
GetMachineByAddress(context.Context, *QueryGetMachineByAddressRequest) (*QueryGetMachineByAddressResponse, error)
// Queries a list of GetLiquidAssetsByMachineid items.
GetLiquidAssetsByMachineid(context.Context, *QueryGetLiquidAssetsByMachineidRequest) (*QueryGetLiquidAssetsByMachineidResponse, error)
// Queries a list of ActivatedTrustAnchorCount items.
ActivatedTrustAnchorCount(context.Context, *QueryActivatedTrustAnchorCountRequest) (*QueryActivatedTrustAnchorCountResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -649,6 +751,9 @@ func (*UnimplementedQueryServer) GetMachineByAddress(ctx context.Context, req *Q
func (*UnimplementedQueryServer) GetLiquidAssetsByMachineid(ctx context.Context, req *QueryGetLiquidAssetsByMachineidRequest) (*QueryGetLiquidAssetsByMachineidResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetLiquidAssetsByMachineid not implemented")
}
func (*UnimplementedQueryServer) ActivatedTrustAnchorCount(ctx context.Context, req *QueryActivatedTrustAnchorCountRequest) (*QueryActivatedTrustAnchorCountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ActivatedTrustAnchorCount not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@ -744,6 +849,24 @@ func _Query_GetLiquidAssetsByMachineid_Handler(srv interface{}, ctx context.Cont
return interceptor(ctx, in, info, handler)
}
func _Query_ActivatedTrustAnchorCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryActivatedTrustAnchorCountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ActivatedTrustAnchorCount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/planetmintgo.machine.Query/ActivatedTrustAnchorCount",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ActivatedTrustAnchorCount(ctx, req.(*QueryActivatedTrustAnchorCountRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "planetmintgo.machine.Query",
HandlerType: (*QueryServer)(nil),
@ -768,6 +891,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "GetLiquidAssetsByMachineid",
Handler: _Query_GetLiquidAssetsByMachineid_Handler,
},
{
MethodName: "ActivatedTrustAnchorCount",
Handler: _Query_ActivatedTrustAnchorCount_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "planetmintgo/machine/query.proto",
@ -1094,6 +1221,57 @@ func (m *QueryGetLiquidAssetsByMachineidResponse) MarshalToSizedBuffer(dAtA []by
return len(dAtA) - i, nil
}
func (m *QueryActivatedTrustAnchorCountRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryActivatedTrustAnchorCountRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryActivatedTrustAnchorCountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryActivatedTrustAnchorCountResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryActivatedTrustAnchorCountResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryActivatedTrustAnchorCountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Count != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Count))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
@ -1232,6 +1410,27 @@ func (m *QueryGetLiquidAssetsByMachineidResponse) Size() (n int) {
return n
}
func (m *QueryActivatedTrustAnchorCountRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryActivatedTrustAnchorCountResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Count != 0 {
n += 1 + sovQuery(uint64(m.Count))
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -2059,6 +2258,125 @@ func (m *QueryGetLiquidAssetsByMachineidResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *QueryActivatedTrustAnchorCountRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryActivatedTrustAnchorCountRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryActivatedTrustAnchorCountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryActivatedTrustAnchorCountResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryActivatedTrustAnchorCountResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryActivatedTrustAnchorCountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType)
}
m.Count = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Count |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0

View File

@ -267,6 +267,24 @@ func local_request_Query_GetLiquidAssetsByMachineid_0(ctx context.Context, marsh
}
func request_Query_ActivatedTrustAnchorCount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryActivatedTrustAnchorCountRequest
var metadata runtime.ServerMetadata
msg, err := client.ActivatedTrustAnchorCount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ActivatedTrustAnchorCount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryActivatedTrustAnchorCountRequest
var metadata runtime.ServerMetadata
msg, err := server.ActivatedTrustAnchorCount(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -388,6 +406,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
mux.Handle("GET", pattern_Query_ActivatedTrustAnchorCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_ActivatedTrustAnchorCount_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ActivatedTrustAnchorCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -529,6 +570,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
mux.Handle("GET", pattern_Query_ActivatedTrustAnchorCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_ActivatedTrustAnchorCount_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_ActivatedTrustAnchorCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -542,6 +603,8 @@ var (
pattern_Query_GetMachineByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 2}, []string{"planetmint", "machine", "address"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetLiquidAssetsByMachineid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"planetmint", "machine", "liquid_assets", "machineID"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ActivatedTrustAnchorCount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint", "machine", "activated_trust_anchor_count"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
@ -554,4 +617,6 @@ var (
forward_Query_GetMachineByAddress_0 = runtime.ForwardResponseMessage
forward_Query_GetLiquidAssetsByMachineid_0 = runtime.ForwardResponseMessage
forward_Query_ActivatedTrustAnchorCount_0 = runtime.ForwardResponseMessage
)