mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
refactor: remove unused code related to whitelisted assets
This commit is contained in:
+42
-5494
File diff suppressed because it is too large
Load Diff
+1243
-26
File diff suppressed because it is too large
Load Diff
@@ -9,123 +9,123 @@ import (
|
||||
ormerrors "cosmossdk.io/orm/types/ormerrors"
|
||||
)
|
||||
|
||||
type AliasTable interface {
|
||||
Insert(ctx context.Context, alias *Alias) error
|
||||
Update(ctx context.Context, alias *Alias) error
|
||||
Save(ctx context.Context, alias *Alias) error
|
||||
Delete(ctx context.Context, alias *Alias) error
|
||||
Has(ctx context.Context, id string) (found bool, err error)
|
||||
type AuthenticationTable interface {
|
||||
Insert(ctx context.Context, authentication *Authentication) error
|
||||
Update(ctx context.Context, authentication *Authentication) error
|
||||
Save(ctx context.Context, authentication *Authentication) error
|
||||
Delete(ctx context.Context, authentication *Authentication) error
|
||||
Has(ctx context.Context, did string) (found bool, err error)
|
||||
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
Get(ctx context.Context, id string) (*Alias, error)
|
||||
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
|
||||
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Alias, error)
|
||||
List(ctx context.Context, prefixKey AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error)
|
||||
ListRange(ctx context.Context, from, to AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey AliasIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to AliasIndexKey) error
|
||||
Get(ctx context.Context, did string) (*Authentication, error)
|
||||
HasByControllerSubject(ctx context.Context, controller string, subject string) (found bool, err error)
|
||||
// GetByControllerSubject returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
GetByControllerSubject(ctx context.Context, controller string, subject string) (*Authentication, error)
|
||||
List(ctx context.Context, prefixKey AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error)
|
||||
ListRange(ctx context.Context, from, to AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey AuthenticationIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to AuthenticationIndexKey) error
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type AliasIterator struct {
|
||||
type AuthenticationIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i AliasIterator) Value() (*Alias, error) {
|
||||
var alias Alias
|
||||
err := i.UnmarshalMessage(&alias)
|
||||
return &alias, err
|
||||
func (i AuthenticationIterator) Value() (*Authentication, error) {
|
||||
var authentication Authentication
|
||||
err := i.UnmarshalMessage(&authentication)
|
||||
return &authentication, err
|
||||
}
|
||||
|
||||
type AliasIndexKey interface {
|
||||
type AuthenticationIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
aliasIndexKey()
|
||||
authenticationIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type AliasPrimaryKey = AliasIdIndexKey
|
||||
type AuthenticationPrimaryKey = AuthenticationDidIndexKey
|
||||
|
||||
type AliasIdIndexKey struct {
|
||||
type AuthenticationDidIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x AliasIdIndexKey) id() uint32 { return 0 }
|
||||
func (x AliasIdIndexKey) values() []interface{} { return x.vs }
|
||||
func (x AliasIdIndexKey) aliasIndexKey() {}
|
||||
func (x AuthenticationDidIndexKey) id() uint32 { return 0 }
|
||||
func (x AuthenticationDidIndexKey) values() []interface{} { return x.vs }
|
||||
func (x AuthenticationDidIndexKey) authenticationIndexKey() {}
|
||||
|
||||
func (this AliasIdIndexKey) WithId(id string) AliasIdIndexKey {
|
||||
this.vs = []interface{}{id}
|
||||
func (this AuthenticationDidIndexKey) WithDid(did string) AuthenticationDidIndexKey {
|
||||
this.vs = []interface{}{did}
|
||||
return this
|
||||
}
|
||||
|
||||
type AliasSubjectOriginIndexKey struct {
|
||||
type AuthenticationControllerSubjectIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x AliasSubjectOriginIndexKey) id() uint32 { return 1 }
|
||||
func (x AliasSubjectOriginIndexKey) values() []interface{} { return x.vs }
|
||||
func (x AliasSubjectOriginIndexKey) aliasIndexKey() {}
|
||||
func (x AuthenticationControllerSubjectIndexKey) id() uint32 { return 1 }
|
||||
func (x AuthenticationControllerSubjectIndexKey) values() []interface{} { return x.vs }
|
||||
func (x AuthenticationControllerSubjectIndexKey) authenticationIndexKey() {}
|
||||
|
||||
func (this AliasSubjectOriginIndexKey) WithSubject(subject string) AliasSubjectOriginIndexKey {
|
||||
this.vs = []interface{}{subject}
|
||||
func (this AuthenticationControllerSubjectIndexKey) WithController(controller string) AuthenticationControllerSubjectIndexKey {
|
||||
this.vs = []interface{}{controller}
|
||||
return this
|
||||
}
|
||||
|
||||
func (this AliasSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) AliasSubjectOriginIndexKey {
|
||||
this.vs = []interface{}{subject, origin}
|
||||
func (this AuthenticationControllerSubjectIndexKey) WithControllerSubject(controller string, subject string) AuthenticationControllerSubjectIndexKey {
|
||||
this.vs = []interface{}{controller, subject}
|
||||
return this
|
||||
}
|
||||
|
||||
type aliasTable struct {
|
||||
type authenticationTable struct {
|
||||
table ormtable.Table
|
||||
}
|
||||
|
||||
func (this aliasTable) Insert(ctx context.Context, alias *Alias) error {
|
||||
return this.table.Insert(ctx, alias)
|
||||
func (this authenticationTable) Insert(ctx context.Context, authentication *Authentication) error {
|
||||
return this.table.Insert(ctx, authentication)
|
||||
}
|
||||
|
||||
func (this aliasTable) Update(ctx context.Context, alias *Alias) error {
|
||||
return this.table.Update(ctx, alias)
|
||||
func (this authenticationTable) Update(ctx context.Context, authentication *Authentication) error {
|
||||
return this.table.Update(ctx, authentication)
|
||||
}
|
||||
|
||||
func (this aliasTable) Save(ctx context.Context, alias *Alias) error {
|
||||
return this.table.Save(ctx, alias)
|
||||
func (this authenticationTable) Save(ctx context.Context, authentication *Authentication) error {
|
||||
return this.table.Save(ctx, authentication)
|
||||
}
|
||||
|
||||
func (this aliasTable) Delete(ctx context.Context, alias *Alias) error {
|
||||
return this.table.Delete(ctx, alias)
|
||||
func (this authenticationTable) Delete(ctx context.Context, authentication *Authentication) error {
|
||||
return this.table.Delete(ctx, authentication)
|
||||
}
|
||||
|
||||
func (this aliasTable) Has(ctx context.Context, id string) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, id)
|
||||
func (this authenticationTable) Has(ctx context.Context, did string) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, did)
|
||||
}
|
||||
|
||||
func (this aliasTable) Get(ctx context.Context, id string) (*Alias, error) {
|
||||
var alias Alias
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &alias, id)
|
||||
func (this authenticationTable) Get(ctx context.Context, did string) (*Authentication, error) {
|
||||
var authentication Authentication
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &authentication, did)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &alias, nil
|
||||
return &authentication, nil
|
||||
}
|
||||
|
||||
func (this aliasTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
|
||||
func (this authenticationTable) HasByControllerSubject(ctx context.Context, controller string, subject string) (found bool, err error) {
|
||||
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
|
||||
controller,
|
||||
subject,
|
||||
origin,
|
||||
)
|
||||
}
|
||||
|
||||
func (this aliasTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Alias, error) {
|
||||
var alias Alias
|
||||
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &alias,
|
||||
func (this authenticationTable) GetByControllerSubject(ctx context.Context, controller string, subject string) (*Authentication, error) {
|
||||
var authentication Authentication
|
||||
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &authentication,
|
||||
controller,
|
||||
subject,
|
||||
origin,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -133,37 +133,37 @@ func (this aliasTable) GetBySubjectOrigin(ctx context.Context, subject string, o
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &alias, nil
|
||||
return &authentication, nil
|
||||
}
|
||||
|
||||
func (this aliasTable) List(ctx context.Context, prefixKey AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error) {
|
||||
func (this authenticationTable) List(ctx context.Context, prefixKey AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error) {
|
||||
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
|
||||
return AliasIterator{it}, err
|
||||
return AuthenticationIterator{it}, err
|
||||
}
|
||||
|
||||
func (this aliasTable) ListRange(ctx context.Context, from, to AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error) {
|
||||
func (this authenticationTable) ListRange(ctx context.Context, from, to AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error) {
|
||||
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
|
||||
return AliasIterator{it}, err
|
||||
return AuthenticationIterator{it}, err
|
||||
}
|
||||
|
||||
func (this aliasTable) DeleteBy(ctx context.Context, prefixKey AliasIndexKey) error {
|
||||
func (this authenticationTable) DeleteBy(ctx context.Context, prefixKey AuthenticationIndexKey) error {
|
||||
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||
}
|
||||
|
||||
func (this aliasTable) DeleteRange(ctx context.Context, from, to AliasIndexKey) error {
|
||||
func (this authenticationTable) DeleteRange(ctx context.Context, from, to AuthenticationIndexKey) error {
|
||||
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||
}
|
||||
|
||||
func (this aliasTable) doNotImplement() {}
|
||||
func (this authenticationTable) doNotImplement() {}
|
||||
|
||||
var _ AliasTable = aliasTable{}
|
||||
var _ AuthenticationTable = authenticationTable{}
|
||||
|
||||
func NewAliasTable(db ormtable.Schema) (AliasTable, error) {
|
||||
table := db.GetTable(&Alias{})
|
||||
func NewAuthenticationTable(db ormtable.Schema) (AuthenticationTable, error) {
|
||||
table := db.GetTable(&Authentication{})
|
||||
if table == nil {
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&Alias{}).ProtoReflect().Descriptor().FullName()))
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&Authentication{}).ProtoReflect().Descriptor().FullName()))
|
||||
}
|
||||
return aliasTable{table}, nil
|
||||
return authenticationTable{table}, nil
|
||||
}
|
||||
|
||||
type ControllerTable interface {
|
||||
@@ -692,7 +692,7 @@ func NewVerificationTable(db ormtable.Schema) (VerificationTable, error) {
|
||||
}
|
||||
|
||||
type StateStore interface {
|
||||
AliasTable() AliasTable
|
||||
AuthenticationTable() AuthenticationTable
|
||||
ControllerTable() ControllerTable
|
||||
VerificationTable() VerificationTable
|
||||
|
||||
@@ -700,13 +700,13 @@ type StateStore interface {
|
||||
}
|
||||
|
||||
type stateStore struct {
|
||||
alias AliasTable
|
||||
controller ControllerTable
|
||||
verification VerificationTable
|
||||
authentication AuthenticationTable
|
||||
controller ControllerTable
|
||||
verification VerificationTable
|
||||
}
|
||||
|
||||
func (x stateStore) AliasTable() AliasTable {
|
||||
return x.alias
|
||||
func (x stateStore) AuthenticationTable() AuthenticationTable {
|
||||
return x.authentication
|
||||
}
|
||||
|
||||
func (x stateStore) ControllerTable() ControllerTable {
|
||||
@@ -722,7 +722,7 @@ func (stateStore) doNotImplement() {}
|
||||
var _ StateStore = stateStore{}
|
||||
|
||||
func NewStateStore(db ormtable.Schema) (StateStore, error) {
|
||||
aliasTable, err := NewAliasTable(db)
|
||||
authenticationTable, err := NewAuthenticationTable(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -738,7 +738,7 @@ func NewStateStore(db ormtable.Schema) (StateStore, error) {
|
||||
}
|
||||
|
||||
return stateStore{
|
||||
aliasTable,
|
||||
authenticationTable,
|
||||
controllerTable,
|
||||
verificationTable,
|
||||
}, nil
|
||||
|
||||
+2593
-235
File diff suppressed because it is too large
Load Diff
+51
-2657
File diff suppressed because it is too large
Load Diff
@@ -19,10 +19,8 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Msg_AuthorizeService_FullMethodName = "/did.v1.Msg/AuthorizeService"
|
||||
Msg_ExecuteTx_FullMethodName = "/did.v1.Msg/ExecuteTx"
|
||||
Msg_RegisterController_FullMethodName = "/did.v1.Msg/RegisterController"
|
||||
Msg_RegisterService_FullMethodName = "/did.v1.Msg/RegisterService"
|
||||
Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams"
|
||||
)
|
||||
|
||||
@@ -30,18 +28,12 @@ const (
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type MsgClient interface {
|
||||
// AuthorizeService asserts the given controller is the owner of the given
|
||||
// address.
|
||||
AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error)
|
||||
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
|
||||
// Macaroon for verification.
|
||||
ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error)
|
||||
// RegisterController initializes a controller with the given authentication
|
||||
// set, address, cid, publicKey, and user-defined alias.
|
||||
RegisterController(ctx context.Context, in *MsgRegisterController, opts ...grpc.CallOption) (*MsgRegisterControllerResponse, error)
|
||||
// RegisterService initializes a Service with a given permission scope and
|
||||
// URI. The domain must have a valid TXT record containing the public key.
|
||||
RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error)
|
||||
// UpdateParams defines a governance operation for updating the parameters.
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
}
|
||||
@@ -54,15 +46,6 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
|
||||
return &msgClient{cc}
|
||||
}
|
||||
|
||||
func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error) {
|
||||
out := new(MsgAuthorizeServiceResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_AuthorizeService_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) {
|
||||
out := new(MsgExecuteTxResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_ExecuteTx_FullMethodName, in, out, opts...)
|
||||
@@ -81,15 +64,6 @@ func (c *msgClient) RegisterController(ctx context.Context, in *MsgRegisterContr
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error) {
|
||||
out := new(MsgRegisterServiceResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_RegisterService_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
|
||||
out := new(MsgUpdateParamsResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
|
||||
@@ -103,18 +77,12 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
|
||||
// All implementations must embed UnimplementedMsgServer
|
||||
// for forward compatibility
|
||||
type MsgServer interface {
|
||||
// AuthorizeService asserts the given controller is the owner of the given
|
||||
// address.
|
||||
AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error)
|
||||
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
|
||||
// Macaroon for verification.
|
||||
ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error)
|
||||
// RegisterController initializes a controller with the given authentication
|
||||
// set, address, cid, publicKey, and user-defined alias.
|
||||
RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error)
|
||||
// RegisterService initializes a Service with a given permission scope and
|
||||
// URI. The domain must have a valid TXT record containing the public key.
|
||||
RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error)
|
||||
// UpdateParams defines a governance operation for updating the parameters.
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
@@ -124,18 +92,12 @@ type MsgServer interface {
|
||||
type UnimplementedMsgServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedMsgServer) AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ExecuteTx not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterController not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
@@ -152,24 +114,6 @@ func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
|
||||
s.RegisterService(&Msg_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgAuthorizeService)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).AuthorizeService(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_AuthorizeService_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).AuthorizeService(ctx, req.(*MsgAuthorizeService))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_ExecuteTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgExecuteTx)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -206,24 +150,6 @@ func _Msg_RegisterController_Handler(srv interface{}, ctx context.Context, dec f
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_RegisterService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgRegisterService)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).RegisterService(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_RegisterService_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).RegisterService(ctx, req.(*MsgRegisterService))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgUpdateParams)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -249,10 +175,6 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "did.v1.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "AuthorizeService",
|
||||
Handler: _Msg_AuthorizeService_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ExecuteTx",
|
||||
Handler: _Msg_ExecuteTx_Handler,
|
||||
@@ -261,10 +183,6 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "RegisterController",
|
||||
Handler: _Msg_RegisterController_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RegisterService",
|
||||
Handler: _Msg_RegisterService_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
|
||||
+1875
-64
File diff suppressed because it is too large
Load Diff
+1934
-28
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,9 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Query_Params_FullMethodName = "/macaroon.v1.Query/Params"
|
||||
Query_Params_FullMethodName = "/macaroon.v1.Query/Params"
|
||||
Query_RefreshToken_FullMethodName = "/macaroon.v1.Query/RefreshToken"
|
||||
Query_ValidateToken_FullMethodName = "/macaroon.v1.Query/ValidateToken"
|
||||
)
|
||||
|
||||
// QueryClient is the client API for Query service.
|
||||
@@ -28,6 +30,10 @@ const (
|
||||
type QueryClient interface {
|
||||
// Params queries all parameters of the module.
|
||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||
// RefreshToken refreshes a macaroon token as post authentication.
|
||||
RefreshToken(ctx context.Context, in *QueryRefreshTokenRequest, opts ...grpc.CallOption) (*QueryRefreshTokenResponse, error)
|
||||
// ValidateToken validates a macaroon token as pre authentication.
|
||||
ValidateToken(ctx context.Context, in *QueryValidateTokenRequest, opts ...grpc.CallOption) (*QueryValidateTokenResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
@@ -47,12 +53,34 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) RefreshToken(ctx context.Context, in *QueryRefreshTokenRequest, opts ...grpc.CallOption) (*QueryRefreshTokenResponse, error) {
|
||||
out := new(QueryRefreshTokenResponse)
|
||||
err := c.cc.Invoke(ctx, Query_RefreshToken_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ValidateToken(ctx context.Context, in *QueryValidateTokenRequest, opts ...grpc.CallOption) (*QueryValidateTokenResponse, error) {
|
||||
out := new(QueryValidateTokenResponse)
|
||||
err := c.cc.Invoke(ctx, Query_ValidateToken_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServer is the server API for Query service.
|
||||
// All implementations must embed UnimplementedQueryServer
|
||||
// for forward compatibility
|
||||
type QueryServer interface {
|
||||
// Params queries all parameters of the module.
|
||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||
// RefreshToken refreshes a macaroon token as post authentication.
|
||||
RefreshToken(context.Context, *QueryRefreshTokenRequest) (*QueryRefreshTokenResponse, error)
|
||||
// ValidateToken validates a macaroon token as pre authentication.
|
||||
ValidateToken(context.Context, *QueryValidateTokenRequest) (*QueryValidateTokenResponse, error)
|
||||
mustEmbedUnimplementedQueryServer()
|
||||
}
|
||||
|
||||
@@ -63,6 +91,12 @@ type UnimplementedQueryServer struct {
|
||||
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) RefreshToken(context.Context, *QueryRefreshTokenRequest) (*QueryRefreshTokenResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RefreshToken not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) ValidateToken(context.Context, *QueryValidateTokenRequest) (*QueryValidateTokenResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ValidateToken not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
||||
|
||||
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
|
||||
@@ -94,6 +128,42 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryRefreshTokenRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).RefreshToken(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_RefreshToken_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).RefreshToken(ctx, req.(*QueryRefreshTokenRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ValidateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryValidateTokenRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).ValidateToken(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_ValidateToken_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).ValidateToken(ctx, req.(*QueryValidateTokenRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -105,6 +175,14 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Params",
|
||||
Handler: _Query_Params_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RefreshToken",
|
||||
Handler: _Query_RefreshToken_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ValidateToken",
|
||||
Handler: _Query_ValidateToken_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "macaroon/v1/query.proto",
|
||||
|
||||
@@ -9,145 +9,185 @@ import (
|
||||
ormerrors "cosmossdk.io/orm/types/ormerrors"
|
||||
)
|
||||
|
||||
type ExampleDataTable interface {
|
||||
Insert(ctx context.Context, exampleData *ExampleData) error
|
||||
Update(ctx context.Context, exampleData *ExampleData) error
|
||||
Save(ctx context.Context, exampleData *ExampleData) error
|
||||
Delete(ctx context.Context, exampleData *ExampleData) error
|
||||
Has(ctx context.Context, account []byte) (found bool, err error)
|
||||
type GrantTable interface {
|
||||
Insert(ctx context.Context, grant *Grant) error
|
||||
InsertReturningId(ctx context.Context, grant *Grant) (uint64, error)
|
||||
LastInsertedSequence(ctx context.Context) (uint64, error)
|
||||
Update(ctx context.Context, grant *Grant) error
|
||||
Save(ctx context.Context, grant *Grant) error
|
||||
Delete(ctx context.Context, grant *Grant) error
|
||||
Has(ctx context.Context, id uint64) (found bool, err error)
|
||||
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
Get(ctx context.Context, account []byte) (*ExampleData, error)
|
||||
List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error)
|
||||
ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error
|
||||
Get(ctx context.Context, id uint64) (*Grant, error)
|
||||
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
|
||||
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Grant, error)
|
||||
List(ctx context.Context, prefixKey GrantIndexKey, opts ...ormlist.Option) (GrantIterator, error)
|
||||
ListRange(ctx context.Context, from, to GrantIndexKey, opts ...ormlist.Option) (GrantIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey GrantIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to GrantIndexKey) error
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type ExampleDataIterator struct {
|
||||
type GrantIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i ExampleDataIterator) Value() (*ExampleData, error) {
|
||||
var exampleData ExampleData
|
||||
err := i.UnmarshalMessage(&exampleData)
|
||||
return &exampleData, err
|
||||
func (i GrantIterator) Value() (*Grant, error) {
|
||||
var grant Grant
|
||||
err := i.UnmarshalMessage(&grant)
|
||||
return &grant, err
|
||||
}
|
||||
|
||||
type ExampleDataIndexKey interface {
|
||||
type GrantIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
exampleDataIndexKey()
|
||||
grantIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type ExampleDataPrimaryKey = ExampleDataAccountIndexKey
|
||||
type GrantPrimaryKey = GrantIdIndexKey
|
||||
|
||||
type ExampleDataAccountIndexKey struct {
|
||||
type GrantIdIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ExampleDataAccountIndexKey) id() uint32 { return 0 }
|
||||
func (x ExampleDataAccountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ExampleDataAccountIndexKey) exampleDataIndexKey() {}
|
||||
func (x GrantIdIndexKey) id() uint32 { return 0 }
|
||||
func (x GrantIdIndexKey) values() []interface{} { return x.vs }
|
||||
func (x GrantIdIndexKey) grantIndexKey() {}
|
||||
|
||||
func (this ExampleDataAccountIndexKey) WithAccount(account []byte) ExampleDataAccountIndexKey {
|
||||
this.vs = []interface{}{account}
|
||||
func (this GrantIdIndexKey) WithId(id uint64) GrantIdIndexKey {
|
||||
this.vs = []interface{}{id}
|
||||
return this
|
||||
}
|
||||
|
||||
type ExampleDataAmountIndexKey struct {
|
||||
type GrantSubjectOriginIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ExampleDataAmountIndexKey) id() uint32 { return 1 }
|
||||
func (x ExampleDataAmountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ExampleDataAmountIndexKey) exampleDataIndexKey() {}
|
||||
func (x GrantSubjectOriginIndexKey) id() uint32 { return 1 }
|
||||
func (x GrantSubjectOriginIndexKey) values() []interface{} { return x.vs }
|
||||
func (x GrantSubjectOriginIndexKey) grantIndexKey() {}
|
||||
|
||||
func (this ExampleDataAmountIndexKey) WithAmount(amount uint64) ExampleDataAmountIndexKey {
|
||||
this.vs = []interface{}{amount}
|
||||
func (this GrantSubjectOriginIndexKey) WithSubject(subject string) GrantSubjectOriginIndexKey {
|
||||
this.vs = []interface{}{subject}
|
||||
return this
|
||||
}
|
||||
|
||||
type exampleDataTable struct {
|
||||
table ormtable.Table
|
||||
func (this GrantSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) GrantSubjectOriginIndexKey {
|
||||
this.vs = []interface{}{subject, origin}
|
||||
return this
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Insert(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Insert(ctx, exampleData)
|
||||
type grantTable struct {
|
||||
table ormtable.AutoIncrementTable
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Update(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Update(ctx, exampleData)
|
||||
func (this grantTable) Insert(ctx context.Context, grant *Grant) error {
|
||||
return this.table.Insert(ctx, grant)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Save(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Save(ctx, exampleData)
|
||||
func (this grantTable) Update(ctx context.Context, grant *Grant) error {
|
||||
return this.table.Update(ctx, grant)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Delete(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Delete(ctx, exampleData)
|
||||
func (this grantTable) Save(ctx context.Context, grant *Grant) error {
|
||||
return this.table.Save(ctx, grant)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Has(ctx context.Context, account []byte) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, account)
|
||||
func (this grantTable) Delete(ctx context.Context, grant *Grant) error {
|
||||
return this.table.Delete(ctx, grant)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Get(ctx context.Context, account []byte) (*ExampleData, error) {
|
||||
var exampleData ExampleData
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &exampleData, account)
|
||||
func (this grantTable) InsertReturningId(ctx context.Context, grant *Grant) (uint64, error) {
|
||||
return this.table.InsertReturningPKey(ctx, grant)
|
||||
}
|
||||
|
||||
func (this grantTable) LastInsertedSequence(ctx context.Context) (uint64, error) {
|
||||
return this.table.LastInsertedSequence(ctx)
|
||||
}
|
||||
|
||||
func (this grantTable) Has(ctx context.Context, id uint64) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, id)
|
||||
}
|
||||
|
||||
func (this grantTable) Get(ctx context.Context, id uint64) (*Grant, error) {
|
||||
var grant Grant
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &grant, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &exampleData, nil
|
||||
return &grant, nil
|
||||
}
|
||||
|
||||
func (this exampleDataTable) List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) {
|
||||
func (this grantTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
|
||||
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
|
||||
subject,
|
||||
origin,
|
||||
)
|
||||
}
|
||||
|
||||
func (this grantTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Grant, error) {
|
||||
var grant Grant
|
||||
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &grant,
|
||||
subject,
|
||||
origin,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &grant, nil
|
||||
}
|
||||
|
||||
func (this grantTable) List(ctx context.Context, prefixKey GrantIndexKey, opts ...ormlist.Option) (GrantIterator, error) {
|
||||
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
|
||||
return ExampleDataIterator{it}, err
|
||||
return GrantIterator{it}, err
|
||||
}
|
||||
|
||||
func (this exampleDataTable) ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) {
|
||||
func (this grantTable) ListRange(ctx context.Context, from, to GrantIndexKey, opts ...ormlist.Option) (GrantIterator, error) {
|
||||
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
|
||||
return ExampleDataIterator{it}, err
|
||||
return GrantIterator{it}, err
|
||||
}
|
||||
|
||||
func (this exampleDataTable) DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error {
|
||||
func (this grantTable) DeleteBy(ctx context.Context, prefixKey GrantIndexKey) error {
|
||||
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error {
|
||||
func (this grantTable) DeleteRange(ctx context.Context, from, to GrantIndexKey) error {
|
||||
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||
}
|
||||
|
||||
func (this exampleDataTable) doNotImplement() {}
|
||||
func (this grantTable) doNotImplement() {}
|
||||
|
||||
var _ ExampleDataTable = exampleDataTable{}
|
||||
var _ GrantTable = grantTable{}
|
||||
|
||||
func NewExampleDataTable(db ormtable.Schema) (ExampleDataTable, error) {
|
||||
table := db.GetTable(&ExampleData{})
|
||||
func NewGrantTable(db ormtable.Schema) (GrantTable, error) {
|
||||
table := db.GetTable(&Grant{})
|
||||
if table == nil {
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&ExampleData{}).ProtoReflect().Descriptor().FullName()))
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&Grant{}).ProtoReflect().Descriptor().FullName()))
|
||||
}
|
||||
return exampleDataTable{table}, nil
|
||||
return grantTable{table.(ormtable.AutoIncrementTable)}, nil
|
||||
}
|
||||
|
||||
type StateStore interface {
|
||||
ExampleDataTable() ExampleDataTable
|
||||
GrantTable() GrantTable
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type stateStore struct {
|
||||
exampleData ExampleDataTable
|
||||
grant GrantTable
|
||||
}
|
||||
|
||||
func (x stateStore) ExampleDataTable() ExampleDataTable {
|
||||
return x.exampleData
|
||||
func (x stateStore) GrantTable() GrantTable {
|
||||
return x.grant
|
||||
}
|
||||
|
||||
func (stateStore) doNotImplement() {}
|
||||
@@ -155,12 +195,12 @@ func (stateStore) doNotImplement() {}
|
||||
var _ StateStore = stateStore{}
|
||||
|
||||
func NewStateStore(db ormtable.Schema) (StateStore, error) {
|
||||
exampleDataTable, err := NewExampleDataTable(db)
|
||||
grantTable, err := NewGrantTable(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return stateStore{
|
||||
exampleDataTable,
|
||||
grantTable,
|
||||
}, nil
|
||||
}
|
||||
|
||||
+350
-147
@@ -14,27 +14,33 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
md_ExampleData protoreflect.MessageDescriptor
|
||||
fd_ExampleData_account protoreflect.FieldDescriptor
|
||||
fd_ExampleData_amount protoreflect.FieldDescriptor
|
||||
md_Grant protoreflect.MessageDescriptor
|
||||
fd_Grant_id protoreflect.FieldDescriptor
|
||||
fd_Grant_controller protoreflect.FieldDescriptor
|
||||
fd_Grant_subject protoreflect.FieldDescriptor
|
||||
fd_Grant_origin protoreflect.FieldDescriptor
|
||||
fd_Grant_expiry_height protoreflect.FieldDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_macaroon_v1_state_proto_init()
|
||||
md_ExampleData = File_macaroon_v1_state_proto.Messages().ByName("ExampleData")
|
||||
fd_ExampleData_account = md_ExampleData.Fields().ByName("account")
|
||||
fd_ExampleData_amount = md_ExampleData.Fields().ByName("amount")
|
||||
md_Grant = File_macaroon_v1_state_proto.Messages().ByName("Grant")
|
||||
fd_Grant_id = md_Grant.Fields().ByName("id")
|
||||
fd_Grant_controller = md_Grant.Fields().ByName("controller")
|
||||
fd_Grant_subject = md_Grant.Fields().ByName("subject")
|
||||
fd_Grant_origin = md_Grant.Fields().ByName("origin")
|
||||
fd_Grant_expiry_height = md_Grant.Fields().ByName("expiry_height")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_ExampleData)(nil)
|
||||
var _ protoreflect.Message = (*fastReflection_Grant)(nil)
|
||||
|
||||
type fastReflection_ExampleData ExampleData
|
||||
type fastReflection_Grant Grant
|
||||
|
||||
func (x *ExampleData) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_ExampleData)(x)
|
||||
func (x *Grant) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_Grant)(x)
|
||||
}
|
||||
|
||||
func (x *ExampleData) slowProtoReflect() protoreflect.Message {
|
||||
func (x *Grant) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_macaroon_v1_state_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -46,43 +52,43 @@ func (x *ExampleData) slowProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
var _fastReflection_ExampleData_messageType fastReflection_ExampleData_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_ExampleData_messageType{}
|
||||
var _fastReflection_Grant_messageType fastReflection_Grant_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_Grant_messageType{}
|
||||
|
||||
type fastReflection_ExampleData_messageType struct{}
|
||||
type fastReflection_Grant_messageType struct{}
|
||||
|
||||
func (x fastReflection_ExampleData_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_ExampleData)(nil)
|
||||
func (x fastReflection_Grant_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_Grant)(nil)
|
||||
}
|
||||
func (x fastReflection_ExampleData_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_ExampleData)
|
||||
func (x fastReflection_Grant_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_Grant)
|
||||
}
|
||||
func (x fastReflection_ExampleData_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_ExampleData
|
||||
func (x fastReflection_Grant_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_Grant
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_ExampleData) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_ExampleData
|
||||
func (x *fastReflection_Grant) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_Grant
|
||||
}
|
||||
|
||||
// Type returns the message type, which encapsulates both Go and protobuf
|
||||
// type information. If the Go type information is not needed,
|
||||
// it is recommended that the message descriptor be used instead.
|
||||
func (x *fastReflection_ExampleData) Type() protoreflect.MessageType {
|
||||
return _fastReflection_ExampleData_messageType
|
||||
func (x *fastReflection_Grant) Type() protoreflect.MessageType {
|
||||
return _fastReflection_Grant_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_ExampleData) New() protoreflect.Message {
|
||||
return new(fastReflection_ExampleData)
|
||||
func (x *fastReflection_Grant) New() protoreflect.Message {
|
||||
return new(fastReflection_Grant)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_ExampleData) Interface() protoreflect.ProtoMessage {
|
||||
return (*ExampleData)(x)
|
||||
func (x *fastReflection_Grant) Interface() protoreflect.ProtoMessage {
|
||||
return (*Grant)(x)
|
||||
}
|
||||
|
||||
// Range iterates over every populated field in an undefined order,
|
||||
@@ -90,16 +96,34 @@ func (x *fastReflection_ExampleData) Interface() protoreflect.ProtoMessage {
|
||||
// Range returns immediately if f returns false.
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current field descriptor.
|
||||
func (x *fastReflection_ExampleData) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if len(x.Account) != 0 {
|
||||
value := protoreflect.ValueOfBytes(x.Account)
|
||||
if !f(fd_ExampleData_account, value) {
|
||||
func (x *fastReflection_Grant) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if x.Id != uint64(0) {
|
||||
value := protoreflect.ValueOfUint64(x.Id)
|
||||
if !f(fd_Grant_id, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.Amount != uint64(0) {
|
||||
value := protoreflect.ValueOfUint64(x.Amount)
|
||||
if !f(fd_ExampleData_amount, value) {
|
||||
if x.Controller != "" {
|
||||
value := protoreflect.ValueOfString(x.Controller)
|
||||
if !f(fd_Grant_controller, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.Subject != "" {
|
||||
value := protoreflect.ValueOfString(x.Subject)
|
||||
if !f(fd_Grant_subject, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.Origin != "" {
|
||||
value := protoreflect.ValueOfString(x.Origin)
|
||||
if !f(fd_Grant_origin, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.ExpiryHeight != int64(0) {
|
||||
value := protoreflect.ValueOfInt64(x.ExpiryHeight)
|
||||
if !f(fd_Grant_expiry_height, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -116,17 +140,23 @@ func (x *fastReflection_ExampleData) Range(f func(protoreflect.FieldDescriptor,
|
||||
// In other cases (aside from the nullable cases above),
|
||||
// a proto3 scalar field is populated if it contains a non-zero value, and
|
||||
// a repeated field is populated if it is non-empty.
|
||||
func (x *fastReflection_ExampleData) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
func (x *fastReflection_Grant) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "macaroon.v1.ExampleData.account":
|
||||
return len(x.Account) != 0
|
||||
case "macaroon.v1.ExampleData.amount":
|
||||
return x.Amount != uint64(0)
|
||||
case "macaroon.v1.Grant.id":
|
||||
return x.Id != uint64(0)
|
||||
case "macaroon.v1.Grant.controller":
|
||||
return x.Controller != ""
|
||||
case "macaroon.v1.Grant.subject":
|
||||
return x.Subject != ""
|
||||
case "macaroon.v1.Grant.origin":
|
||||
return x.Origin != ""
|
||||
case "macaroon.v1.Grant.expiry_height":
|
||||
return x.ExpiryHeight != int64(0)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData"))
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
|
||||
}
|
||||
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName()))
|
||||
panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,17 +166,23 @@ func (x *fastReflection_ExampleData) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
// associated with the given field number.
|
||||
//
|
||||
// Clear is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ExampleData) Clear(fd protoreflect.FieldDescriptor) {
|
||||
func (x *fastReflection_Grant) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
case "macaroon.v1.ExampleData.account":
|
||||
x.Account = nil
|
||||
case "macaroon.v1.ExampleData.amount":
|
||||
x.Amount = uint64(0)
|
||||
case "macaroon.v1.Grant.id":
|
||||
x.Id = uint64(0)
|
||||
case "macaroon.v1.Grant.controller":
|
||||
x.Controller = ""
|
||||
case "macaroon.v1.Grant.subject":
|
||||
x.Subject = ""
|
||||
case "macaroon.v1.Grant.origin":
|
||||
x.Origin = ""
|
||||
case "macaroon.v1.Grant.expiry_height":
|
||||
x.ExpiryHeight = int64(0)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData"))
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
|
||||
}
|
||||
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName()))
|
||||
panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,19 +192,28 @@ func (x *fastReflection_ExampleData) Clear(fd protoreflect.FieldDescriptor) {
|
||||
// the default value of a bytes scalar is guaranteed to be a copy.
|
||||
// For unpopulated composite types, it returns an empty, read-only view
|
||||
// of the value; to obtain a mutable reference, use Mutable.
|
||||
func (x *fastReflection_ExampleData) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
func (x *fastReflection_Grant) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
case "macaroon.v1.ExampleData.account":
|
||||
value := x.Account
|
||||
return protoreflect.ValueOfBytes(value)
|
||||
case "macaroon.v1.ExampleData.amount":
|
||||
value := x.Amount
|
||||
case "macaroon.v1.Grant.id":
|
||||
value := x.Id
|
||||
return protoreflect.ValueOfUint64(value)
|
||||
case "macaroon.v1.Grant.controller":
|
||||
value := x.Controller
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "macaroon.v1.Grant.subject":
|
||||
value := x.Subject
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "macaroon.v1.Grant.origin":
|
||||
value := x.Origin
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "macaroon.v1.Grant.expiry_height":
|
||||
value := x.ExpiryHeight
|
||||
return protoreflect.ValueOfInt64(value)
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData"))
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
|
||||
}
|
||||
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", descriptor.FullName()))
|
||||
panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", descriptor.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,17 +227,23 @@ func (x *fastReflection_ExampleData) Get(descriptor protoreflect.FieldDescriptor
|
||||
// empty, read-only value, then it panics.
|
||||
//
|
||||
// Set is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ExampleData) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
func (x *fastReflection_Grant) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "macaroon.v1.ExampleData.account":
|
||||
x.Account = value.Bytes()
|
||||
case "macaroon.v1.ExampleData.amount":
|
||||
x.Amount = value.Uint()
|
||||
case "macaroon.v1.Grant.id":
|
||||
x.Id = value.Uint()
|
||||
case "macaroon.v1.Grant.controller":
|
||||
x.Controller = value.Interface().(string)
|
||||
case "macaroon.v1.Grant.subject":
|
||||
x.Subject = value.Interface().(string)
|
||||
case "macaroon.v1.Grant.origin":
|
||||
x.Origin = value.Interface().(string)
|
||||
case "macaroon.v1.Grant.expiry_height":
|
||||
x.ExpiryHeight = value.Int()
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData"))
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
|
||||
}
|
||||
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName()))
|
||||
panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,44 +257,56 @@ func (x *fastReflection_ExampleData) Set(fd protoreflect.FieldDescriptor, value
|
||||
// It panics if the field does not contain a composite type.
|
||||
//
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ExampleData) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
func (x *fastReflection_Grant) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "macaroon.v1.ExampleData.account":
|
||||
panic(fmt.Errorf("field account of message macaroon.v1.ExampleData is not mutable"))
|
||||
case "macaroon.v1.ExampleData.amount":
|
||||
panic(fmt.Errorf("field amount of message macaroon.v1.ExampleData is not mutable"))
|
||||
case "macaroon.v1.Grant.id":
|
||||
panic(fmt.Errorf("field id of message macaroon.v1.Grant is not mutable"))
|
||||
case "macaroon.v1.Grant.controller":
|
||||
panic(fmt.Errorf("field controller of message macaroon.v1.Grant is not mutable"))
|
||||
case "macaroon.v1.Grant.subject":
|
||||
panic(fmt.Errorf("field subject of message macaroon.v1.Grant is not mutable"))
|
||||
case "macaroon.v1.Grant.origin":
|
||||
panic(fmt.Errorf("field origin of message macaroon.v1.Grant is not mutable"))
|
||||
case "macaroon.v1.Grant.expiry_height":
|
||||
panic(fmt.Errorf("field expiry_height of message macaroon.v1.Grant is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData"))
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
|
||||
}
|
||||
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName()))
|
||||
panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// NewField returns a new value that is assignable to the field
|
||||
// for the given descriptor. For scalars, this returns the default value.
|
||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||
func (x *fastReflection_ExampleData) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
func (x *fastReflection_Grant) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "macaroon.v1.ExampleData.account":
|
||||
return protoreflect.ValueOfBytes(nil)
|
||||
case "macaroon.v1.ExampleData.amount":
|
||||
case "macaroon.v1.Grant.id":
|
||||
return protoreflect.ValueOfUint64(uint64(0))
|
||||
case "macaroon.v1.Grant.controller":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "macaroon.v1.Grant.subject":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "macaroon.v1.Grant.origin":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "macaroon.v1.Grant.expiry_height":
|
||||
return protoreflect.ValueOfInt64(int64(0))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData"))
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
|
||||
}
|
||||
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName()))
|
||||
panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// WhichOneof reports which field within the oneof is populated,
|
||||
// returning nil if none are populated.
|
||||
// It panics if the oneof descriptor does not belong to this message.
|
||||
func (x *fastReflection_ExampleData) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
func (x *fastReflection_Grant) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in macaroon.v1.ExampleData", d.FullName()))
|
||||
panic(fmt.Errorf("%s is not a oneof field in macaroon.v1.Grant", d.FullName()))
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
@@ -251,7 +314,7 @@ func (x *fastReflection_ExampleData) WhichOneof(d protoreflect.OneofDescriptor)
|
||||
// GetUnknown retrieves the entire list of unknown fields.
|
||||
// The caller may only mutate the contents of the RawFields
|
||||
// if the mutated bytes are stored back into the message with SetUnknown.
|
||||
func (x *fastReflection_ExampleData) GetUnknown() protoreflect.RawFields {
|
||||
func (x *fastReflection_Grant) GetUnknown() protoreflect.RawFields {
|
||||
return x.unknownFields
|
||||
}
|
||||
|
||||
@@ -262,7 +325,7 @@ func (x *fastReflection_ExampleData) GetUnknown() protoreflect.RawFields {
|
||||
// An empty RawFields may be passed to clear the fields.
|
||||
//
|
||||
// SetUnknown is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ExampleData) SetUnknown(fields protoreflect.RawFields) {
|
||||
func (x *fastReflection_Grant) SetUnknown(fields protoreflect.RawFields) {
|
||||
x.unknownFields = fields
|
||||
}
|
||||
|
||||
@@ -274,7 +337,7 @@ func (x *fastReflection_ExampleData) SetUnknown(fields protoreflect.RawFields) {
|
||||
// message type, but the details are implementation dependent.
|
||||
// Validity is not part of the protobuf data model, and may not
|
||||
// be preserved in marshaling or other operations.
|
||||
func (x *fastReflection_ExampleData) IsValid() bool {
|
||||
func (x *fastReflection_Grant) IsValid() bool {
|
||||
return x != nil
|
||||
}
|
||||
|
||||
@@ -284,9 +347,9 @@ func (x *fastReflection_ExampleData) IsValid() bool {
|
||||
// The returned methods type is identical to
|
||||
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
||||
// Consult the protoiface package documentation for details.
|
||||
func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
|
||||
func (x *fastReflection_Grant) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*ExampleData)
|
||||
x := input.Message.Interface().(*Grant)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
@@ -298,12 +361,23 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
l = len(x.Account)
|
||||
if x.Id != 0 {
|
||||
n += 1 + runtime.Sov(uint64(x.Id))
|
||||
}
|
||||
l = len(x.Controller)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.Amount != 0 {
|
||||
n += 1 + runtime.Sov(uint64(x.Amount))
|
||||
l = len(x.Subject)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
l = len(x.Origin)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.ExpiryHeight != 0 {
|
||||
n += 1 + runtime.Sov(uint64(x.ExpiryHeight))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
n += len(x.unknownFields)
|
||||
@@ -315,7 +389,7 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
|
||||
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||
x := input.Message.Interface().(*ExampleData)
|
||||
x := input.Message.Interface().(*Grant)
|
||||
if x == nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
@@ -334,17 +408,36 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if x.Amount != 0 {
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(x.Amount))
|
||||
if x.ExpiryHeight != 0 {
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(x.ExpiryHeight))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
dAtA[i] = 0x28
|
||||
}
|
||||
if len(x.Account) > 0 {
|
||||
i -= len(x.Account)
|
||||
copy(dAtA[i:], x.Account)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Account)))
|
||||
if len(x.Origin) > 0 {
|
||||
i -= len(x.Origin)
|
||||
copy(dAtA[i:], x.Origin)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Origin)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
if len(x.Subject) > 0 {
|
||||
i -= len(x.Subject)
|
||||
copy(dAtA[i:], x.Subject)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Subject)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(x.Controller) > 0 {
|
||||
i -= len(x.Controller)
|
||||
copy(dAtA[i:], x.Controller)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Controller)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if x.Id != 0 {
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(x.Id))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
if input.Buf != nil {
|
||||
input.Buf = append(input.Buf, dAtA...)
|
||||
@@ -357,7 +450,7 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
|
||||
}, nil
|
||||
}
|
||||
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
x := input.Message.Interface().(*ExampleData)
|
||||
x := input.Message.Interface().(*Grant)
|
||||
if x == nil {
|
||||
return protoiface.UnmarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
@@ -389,17 +482,17 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ExampleData: wiretype end group for non-group")
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Grant: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ExampleData: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Grant: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Account", wireType)
|
||||
if wireType != 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
x.Id = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
@@ -409,31 +502,48 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
x.Id |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Account = append(x.Account[:0], dAtA[iNdEx:postIndex]...)
|
||||
if x.Account == nil {
|
||||
x.Account = []byte{}
|
||||
}
|
||||
x.Controller = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType)
|
||||
}
|
||||
x.Amount = 0
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
@@ -443,7 +553,71 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
x.Amount |= uint64(b&0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Subject = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Origin = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
if wireType != 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExpiryHeight", wireType)
|
||||
}
|
||||
x.ExpiryHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
x.ExpiryHeight |= int64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@@ -496,17 +670,20 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type ExampleData struct {
|
||||
type Grant struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Account []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
|
||||
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
|
||||
Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||
Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||
ExpiryHeight int64 `protobuf:"varint,5,opt,name=expiry_height,json=expiryHeight,proto3" json:"expiry_height,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ExampleData) Reset() {
|
||||
*x = ExampleData{}
|
||||
func (x *Grant) Reset() {
|
||||
*x = Grant{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_macaroon_v1_state_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -514,27 +691,48 @@ func (x *ExampleData) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ExampleData) String() string {
|
||||
func (x *Grant) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExampleData) ProtoMessage() {}
|
||||
func (*Grant) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use ExampleData.ProtoReflect.Descriptor instead.
|
||||
func (*ExampleData) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use Grant.ProtoReflect.Descriptor instead.
|
||||
func (*Grant) Descriptor() ([]byte, []int) {
|
||||
return file_macaroon_v1_state_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ExampleData) GetAccount() []byte {
|
||||
func (x *Grant) GetId() uint64 {
|
||||
if x != nil {
|
||||
return x.Account
|
||||
return x.Id
|
||||
}
|
||||
return nil
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ExampleData) GetAmount() uint64 {
|
||||
func (x *Grant) GetController() string {
|
||||
if x != nil {
|
||||
return x.Amount
|
||||
return x.Controller
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Grant) GetSubject() string {
|
||||
if x != nil {
|
||||
return x.Subject
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Grant) GetOrigin() string {
|
||||
if x != nil {
|
||||
return x.Origin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Grant) GetExpiryHeight() int64 {
|
||||
if x != nil {
|
||||
return x.ExpiryHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@@ -546,23 +744,28 @@ var file_macaroon_v1_state_proto_rawDesc = []byte{
|
||||
0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x61, 0x63, 0x61, 0x72,
|
||||
0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f,
|
||||
0x72, 0x6d, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x60, 0x0a, 0x0b, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||
0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x3a, 0x1f, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x19, 0x0a, 0x09, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x12, 0x0a, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x01, 0x18,
|
||||
0x01, 0x42, 0x9d, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f,
|
||||
0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
||||
0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f,
|
||||
0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x63, 0x61,
|
||||
0x72, 0x6f, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4d,
|
||||
0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0b, 0x4d, 0x61, 0x63,
|
||||
0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x17, 0x4d, 0x61, 0x63, 0x61, 0x72,
|
||||
0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
|
||||
0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x3a, 0x3a, 0x56,
|
||||
0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0xb6, 0x01, 0x0a, 0x05, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62,
|
||||
0x6a, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a,
|
||||
0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x65,
|
||||
0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74,
|
||||
0x3a, 0x26, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x20, 0x0a, 0x06, 0x0a, 0x02, 0x69, 0x64, 0x10, 0x01,
|
||||
0x12, 0x14, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x6f, 0x72, 0x69, 0x67,
|
||||
0x69, 0x6e, 0x10, 0x01, 0x18, 0x01, 0x18, 0x01, 0x42, 0x9d, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d,
|
||||
0x2e, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53, 0x74,
|
||||
0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68,
|
||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f,
|
||||
0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f,
|
||||
0x76, 0x31, 0x3b, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03,
|
||||
0x4d, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x56,
|
||||
0x31, 0xca, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2,
|
||||
0x02, 0x17, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50,
|
||||
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x61, 0x63, 0x61,
|
||||
0x72, 0x6f, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -579,7 +782,7 @@ func file_macaroon_v1_state_proto_rawDescGZIP() []byte {
|
||||
|
||||
var file_macaroon_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_macaroon_v1_state_proto_goTypes = []interface{}{
|
||||
(*ExampleData)(nil), // 0: macaroon.v1.ExampleData
|
||||
(*Grant)(nil), // 0: macaroon.v1.Grant
|
||||
}
|
||||
var file_macaroon_v1_state_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
@@ -596,7 +799,7 @@ func file_macaroon_v1_state_proto_init() {
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_macaroon_v1_state_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ExampleData); i {
|
||||
switch v := v.(*Grant); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
||||
+1529
-35
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,8 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Msg_UpdateParams_FullMethodName = "/macaroon.v1.Msg/UpdateParams"
|
||||
Msg_UpdateParams_FullMethodName = "/macaroon.v1.Msg/UpdateParams"
|
||||
Msg_AuthorizeService_FullMethodName = "/macaroon.v1.Msg/AuthorizeService"
|
||||
)
|
||||
|
||||
// MsgClient is the client API for Msg service.
|
||||
@@ -30,6 +31,9 @@ type MsgClient interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
// AuthorizeService asserts the given controller is the owner of the given
|
||||
// address.
|
||||
AuthorizeService(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@@ -49,6 +53,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error) {
|
||||
out := new(MsgIssueMacaroonResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_AuthorizeService_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
// All implementations must embed UnimplementedMsgServer
|
||||
// for forward compatibility
|
||||
@@ -57,6 +70,9 @@ type MsgServer interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
// AuthorizeService asserts the given controller is the owner of the given
|
||||
// address.
|
||||
AuthorizeService(context.Context, *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
@@ -67,6 +83,9 @@ type UnimplementedMsgServer struct {
|
||||
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) AuthorizeService(context.Context, *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
|
||||
|
||||
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
|
||||
@@ -98,6 +117,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgIssueMacaroon)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).AuthorizeService(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_AuthorizeService_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).AuthorizeService(ctx, req.(*MsgIssueMacaroon))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -109,6 +146,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AuthorizeService",
|
||||
Handler: _Msg_AuthorizeService_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "macaroon/v1/tx.proto",
|
||||
|
||||
+1467
-63
File diff suppressed because it is too large
Load Diff
@@ -9,145 +9,301 @@ import (
|
||||
ormerrors "cosmossdk.io/orm/types/ormerrors"
|
||||
)
|
||||
|
||||
type ExampleDataTable interface {
|
||||
Insert(ctx context.Context, exampleData *ExampleData) error
|
||||
Update(ctx context.Context, exampleData *ExampleData) error
|
||||
Save(ctx context.Context, exampleData *ExampleData) error
|
||||
Delete(ctx context.Context, exampleData *ExampleData) error
|
||||
Has(ctx context.Context, account []byte) (found bool, err error)
|
||||
type BalanceTable interface {
|
||||
Insert(ctx context.Context, balance *Balance) error
|
||||
Update(ctx context.Context, balance *Balance) error
|
||||
Save(ctx context.Context, balance *Balance) error
|
||||
Delete(ctx context.Context, balance *Balance) error
|
||||
Has(ctx context.Context, account string) (found bool, err error)
|
||||
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
Get(ctx context.Context, account []byte) (*ExampleData, error)
|
||||
List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error)
|
||||
ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error
|
||||
Get(ctx context.Context, account string) (*Balance, error)
|
||||
List(ctx context.Context, prefixKey BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error)
|
||||
ListRange(ctx context.Context, from, to BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey BalanceIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to BalanceIndexKey) error
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type ExampleDataIterator struct {
|
||||
type BalanceIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i ExampleDataIterator) Value() (*ExampleData, error) {
|
||||
var exampleData ExampleData
|
||||
err := i.UnmarshalMessage(&exampleData)
|
||||
return &exampleData, err
|
||||
func (i BalanceIterator) Value() (*Balance, error) {
|
||||
var balance Balance
|
||||
err := i.UnmarshalMessage(&balance)
|
||||
return &balance, err
|
||||
}
|
||||
|
||||
type ExampleDataIndexKey interface {
|
||||
type BalanceIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
exampleDataIndexKey()
|
||||
balanceIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type ExampleDataPrimaryKey = ExampleDataAccountIndexKey
|
||||
type BalancePrimaryKey = BalanceAccountIndexKey
|
||||
|
||||
type ExampleDataAccountIndexKey struct {
|
||||
type BalanceAccountIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ExampleDataAccountIndexKey) id() uint32 { return 0 }
|
||||
func (x ExampleDataAccountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ExampleDataAccountIndexKey) exampleDataIndexKey() {}
|
||||
func (x BalanceAccountIndexKey) id() uint32 { return 0 }
|
||||
func (x BalanceAccountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x BalanceAccountIndexKey) balanceIndexKey() {}
|
||||
|
||||
func (this ExampleDataAccountIndexKey) WithAccount(account []byte) ExampleDataAccountIndexKey {
|
||||
func (this BalanceAccountIndexKey) WithAccount(account string) BalanceAccountIndexKey {
|
||||
this.vs = []interface{}{account}
|
||||
return this
|
||||
}
|
||||
|
||||
type ExampleDataAmountIndexKey struct {
|
||||
type BalanceAmountIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ExampleDataAmountIndexKey) id() uint32 { return 1 }
|
||||
func (x ExampleDataAmountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ExampleDataAmountIndexKey) exampleDataIndexKey() {}
|
||||
func (x BalanceAmountIndexKey) id() uint32 { return 1 }
|
||||
func (x BalanceAmountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x BalanceAmountIndexKey) balanceIndexKey() {}
|
||||
|
||||
func (this ExampleDataAmountIndexKey) WithAmount(amount uint64) ExampleDataAmountIndexKey {
|
||||
func (this BalanceAmountIndexKey) WithAmount(amount uint64) BalanceAmountIndexKey {
|
||||
this.vs = []interface{}{amount}
|
||||
return this
|
||||
}
|
||||
|
||||
type exampleDataTable struct {
|
||||
type balanceTable struct {
|
||||
table ormtable.Table
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Insert(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Insert(ctx, exampleData)
|
||||
func (this balanceTable) Insert(ctx context.Context, balance *Balance) error {
|
||||
return this.table.Insert(ctx, balance)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Update(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Update(ctx, exampleData)
|
||||
func (this balanceTable) Update(ctx context.Context, balance *Balance) error {
|
||||
return this.table.Update(ctx, balance)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Save(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Save(ctx, exampleData)
|
||||
func (this balanceTable) Save(ctx context.Context, balance *Balance) error {
|
||||
return this.table.Save(ctx, balance)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Delete(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Delete(ctx, exampleData)
|
||||
func (this balanceTable) Delete(ctx context.Context, balance *Balance) error {
|
||||
return this.table.Delete(ctx, balance)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Has(ctx context.Context, account []byte) (found bool, err error) {
|
||||
func (this balanceTable) Has(ctx context.Context, account string) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, account)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Get(ctx context.Context, account []byte) (*ExampleData, error) {
|
||||
var exampleData ExampleData
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &exampleData, account)
|
||||
func (this balanceTable) Get(ctx context.Context, account string) (*Balance, error) {
|
||||
var balance Balance
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &balance, account)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &exampleData, nil
|
||||
return &balance, nil
|
||||
}
|
||||
|
||||
func (this exampleDataTable) List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) {
|
||||
func (this balanceTable) List(ctx context.Context, prefixKey BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error) {
|
||||
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
|
||||
return ExampleDataIterator{it}, err
|
||||
return BalanceIterator{it}, err
|
||||
}
|
||||
|
||||
func (this exampleDataTable) ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) {
|
||||
func (this balanceTable) ListRange(ctx context.Context, from, to BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error) {
|
||||
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
|
||||
return ExampleDataIterator{it}, err
|
||||
return BalanceIterator{it}, err
|
||||
}
|
||||
|
||||
func (this exampleDataTable) DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error {
|
||||
func (this balanceTable) DeleteBy(ctx context.Context, prefixKey BalanceIndexKey) error {
|
||||
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error {
|
||||
func (this balanceTable) DeleteRange(ctx context.Context, from, to BalanceIndexKey) error {
|
||||
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||
}
|
||||
|
||||
func (this exampleDataTable) doNotImplement() {}
|
||||
func (this balanceTable) doNotImplement() {}
|
||||
|
||||
var _ ExampleDataTable = exampleDataTable{}
|
||||
var _ BalanceTable = balanceTable{}
|
||||
|
||||
func NewExampleDataTable(db ormtable.Schema) (ExampleDataTable, error) {
|
||||
table := db.GetTable(&ExampleData{})
|
||||
func NewBalanceTable(db ormtable.Schema) (BalanceTable, error) {
|
||||
table := db.GetTable(&Balance{})
|
||||
if table == nil {
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&ExampleData{}).ProtoReflect().Descriptor().FullName()))
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&Balance{}).ProtoReflect().Descriptor().FullName()))
|
||||
}
|
||||
return exampleDataTable{table}, nil
|
||||
return balanceTable{table}, nil
|
||||
}
|
||||
|
||||
type AccountTable interface {
|
||||
Insert(ctx context.Context, account *Account) error
|
||||
Update(ctx context.Context, account *Account) error
|
||||
Save(ctx context.Context, account *Account) error
|
||||
Delete(ctx context.Context, account *Account) error
|
||||
Has(ctx context.Context, id uint64) (found bool, err error)
|
||||
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
Get(ctx context.Context, id uint64) (*Account, error)
|
||||
HasByAccount(ctx context.Context, account string) (found bool, err error)
|
||||
// GetByAccount returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
GetByAccount(ctx context.Context, account string) (*Account, error)
|
||||
List(ctx context.Context, prefixKey AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error)
|
||||
ListRange(ctx context.Context, from, to AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey AccountIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to AccountIndexKey) error
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type AccountIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i AccountIterator) Value() (*Account, error) {
|
||||
var account Account
|
||||
err := i.UnmarshalMessage(&account)
|
||||
return &account, err
|
||||
}
|
||||
|
||||
type AccountIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
accountIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type AccountPrimaryKey = AccountIdIndexKey
|
||||
|
||||
type AccountIdIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x AccountIdIndexKey) id() uint32 { return 0 }
|
||||
func (x AccountIdIndexKey) values() []interface{} { return x.vs }
|
||||
func (x AccountIdIndexKey) accountIndexKey() {}
|
||||
|
||||
func (this AccountIdIndexKey) WithId(id uint64) AccountIdIndexKey {
|
||||
this.vs = []interface{}{id}
|
||||
return this
|
||||
}
|
||||
|
||||
type AccountAccountIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x AccountAccountIndexKey) id() uint32 { return 1 }
|
||||
func (x AccountAccountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x AccountAccountIndexKey) accountIndexKey() {}
|
||||
|
||||
func (this AccountAccountIndexKey) WithAccount(account string) AccountAccountIndexKey {
|
||||
this.vs = []interface{}{account}
|
||||
return this
|
||||
}
|
||||
|
||||
type accountTable struct {
|
||||
table ormtable.Table
|
||||
}
|
||||
|
||||
func (this accountTable) Insert(ctx context.Context, account *Account) error {
|
||||
return this.table.Insert(ctx, account)
|
||||
}
|
||||
|
||||
func (this accountTable) Update(ctx context.Context, account *Account) error {
|
||||
return this.table.Update(ctx, account)
|
||||
}
|
||||
|
||||
func (this accountTable) Save(ctx context.Context, account *Account) error {
|
||||
return this.table.Save(ctx, account)
|
||||
}
|
||||
|
||||
func (this accountTable) Delete(ctx context.Context, account *Account) error {
|
||||
return this.table.Delete(ctx, account)
|
||||
}
|
||||
|
||||
func (this accountTable) Has(ctx context.Context, id uint64) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, id)
|
||||
}
|
||||
|
||||
func (this accountTable) Get(ctx context.Context, id uint64) (*Account, error) {
|
||||
var account Account
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &account, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &account, nil
|
||||
}
|
||||
|
||||
func (this accountTable) HasByAccount(ctx context.Context, account string) (found bool, err error) {
|
||||
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
|
||||
account,
|
||||
)
|
||||
}
|
||||
|
||||
func (this accountTable) GetByAccount(ctx context.Context, account string) (*Account, error) {
|
||||
var account Account
|
||||
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &account,
|
||||
account,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &account, nil
|
||||
}
|
||||
|
||||
func (this accountTable) List(ctx context.Context, prefixKey AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error) {
|
||||
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
|
||||
return AccountIterator{it}, err
|
||||
}
|
||||
|
||||
func (this accountTable) ListRange(ctx context.Context, from, to AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error) {
|
||||
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
|
||||
return AccountIterator{it}, err
|
||||
}
|
||||
|
||||
func (this accountTable) DeleteBy(ctx context.Context, prefixKey AccountIndexKey) error {
|
||||
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||
}
|
||||
|
||||
func (this accountTable) DeleteRange(ctx context.Context, from, to AccountIndexKey) error {
|
||||
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||
}
|
||||
|
||||
func (this accountTable) doNotImplement() {}
|
||||
|
||||
var _ AccountTable = accountTable{}
|
||||
|
||||
func NewAccountTable(db ormtable.Schema) (AccountTable, error) {
|
||||
table := db.GetTable(&Account{})
|
||||
if table == nil {
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&Account{}).ProtoReflect().Descriptor().FullName()))
|
||||
}
|
||||
return accountTable{table}, nil
|
||||
}
|
||||
|
||||
type StateStore interface {
|
||||
ExampleDataTable() ExampleDataTable
|
||||
BalanceTable() BalanceTable
|
||||
AccountTable() AccountTable
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type stateStore struct {
|
||||
exampleData ExampleDataTable
|
||||
balance BalanceTable
|
||||
account AccountTable
|
||||
}
|
||||
|
||||
func (x stateStore) ExampleDataTable() ExampleDataTable {
|
||||
return x.exampleData
|
||||
func (x stateStore) BalanceTable() BalanceTable {
|
||||
return x.balance
|
||||
}
|
||||
|
||||
func (x stateStore) AccountTable() AccountTable {
|
||||
return x.account
|
||||
}
|
||||
|
||||
func (stateStore) doNotImplement() {}
|
||||
@@ -155,12 +311,18 @@ func (stateStore) doNotImplement() {}
|
||||
var _ StateStore = stateStore{}
|
||||
|
||||
func NewStateStore(db ormtable.Schema) (StateStore, error) {
|
||||
exampleDataTable, err := NewExampleDataTable(db)
|
||||
balanceTable, err := NewBalanceTable(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
accountTable, err := NewAccountTable(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return stateStore{
|
||||
exampleDataTable,
|
||||
balanceTable,
|
||||
accountTable,
|
||||
}, nil
|
||||
}
|
||||
|
||||
+795
-121
File diff suppressed because it is too large
Load Diff
+1503
-702
File diff suppressed because it is too large
Load Diff
@@ -9,145 +9,341 @@ import (
|
||||
ormerrors "cosmossdk.io/orm/types/ormerrors"
|
||||
)
|
||||
|
||||
type ExampleDataTable interface {
|
||||
Insert(ctx context.Context, exampleData *ExampleData) error
|
||||
Update(ctx context.Context, exampleData *ExampleData) error
|
||||
Save(ctx context.Context, exampleData *ExampleData) error
|
||||
Delete(ctx context.Context, exampleData *ExampleData) error
|
||||
Has(ctx context.Context, account []byte) (found bool, err error)
|
||||
type MetadataTable interface {
|
||||
Insert(ctx context.Context, metadata *Metadata) error
|
||||
InsertReturningId(ctx context.Context, metadata *Metadata) (uint64, error)
|
||||
LastInsertedSequence(ctx context.Context) (uint64, error)
|
||||
Update(ctx context.Context, metadata *Metadata) error
|
||||
Save(ctx context.Context, metadata *Metadata) error
|
||||
Delete(ctx context.Context, metadata *Metadata) error
|
||||
Has(ctx context.Context, id uint64) (found bool, err error)
|
||||
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
Get(ctx context.Context, account []byte) (*ExampleData, error)
|
||||
List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error)
|
||||
ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error
|
||||
Get(ctx context.Context, id uint64) (*Metadata, error)
|
||||
HasByOrigin(ctx context.Context, origin string) (found bool, err error)
|
||||
// GetByOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
GetByOrigin(ctx context.Context, origin string) (*Metadata, error)
|
||||
List(ctx context.Context, prefixKey MetadataIndexKey, opts ...ormlist.Option) (MetadataIterator, error)
|
||||
ListRange(ctx context.Context, from, to MetadataIndexKey, opts ...ormlist.Option) (MetadataIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey MetadataIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to MetadataIndexKey) error
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type ExampleDataIterator struct {
|
||||
type MetadataIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i ExampleDataIterator) Value() (*ExampleData, error) {
|
||||
var exampleData ExampleData
|
||||
err := i.UnmarshalMessage(&exampleData)
|
||||
return &exampleData, err
|
||||
func (i MetadataIterator) Value() (*Metadata, error) {
|
||||
var metadata Metadata
|
||||
err := i.UnmarshalMessage(&metadata)
|
||||
return &metadata, err
|
||||
}
|
||||
|
||||
type ExampleDataIndexKey interface {
|
||||
type MetadataIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
exampleDataIndexKey()
|
||||
metadataIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type ExampleDataPrimaryKey = ExampleDataAccountIndexKey
|
||||
type MetadataPrimaryKey = MetadataIdIndexKey
|
||||
|
||||
type ExampleDataAccountIndexKey struct {
|
||||
type MetadataIdIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ExampleDataAccountIndexKey) id() uint32 { return 0 }
|
||||
func (x ExampleDataAccountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ExampleDataAccountIndexKey) exampleDataIndexKey() {}
|
||||
func (x MetadataIdIndexKey) id() uint32 { return 0 }
|
||||
func (x MetadataIdIndexKey) values() []interface{} { return x.vs }
|
||||
func (x MetadataIdIndexKey) metadataIndexKey() {}
|
||||
|
||||
func (this ExampleDataAccountIndexKey) WithAccount(account []byte) ExampleDataAccountIndexKey {
|
||||
this.vs = []interface{}{account}
|
||||
func (this MetadataIdIndexKey) WithId(id uint64) MetadataIdIndexKey {
|
||||
this.vs = []interface{}{id}
|
||||
return this
|
||||
}
|
||||
|
||||
type ExampleDataAmountIndexKey struct {
|
||||
type MetadataOriginIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ExampleDataAmountIndexKey) id() uint32 { return 1 }
|
||||
func (x ExampleDataAmountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ExampleDataAmountIndexKey) exampleDataIndexKey() {}
|
||||
func (x MetadataOriginIndexKey) id() uint32 { return 1 }
|
||||
func (x MetadataOriginIndexKey) values() []interface{} { return x.vs }
|
||||
func (x MetadataOriginIndexKey) metadataIndexKey() {}
|
||||
|
||||
func (this ExampleDataAmountIndexKey) WithAmount(amount uint64) ExampleDataAmountIndexKey {
|
||||
this.vs = []interface{}{amount}
|
||||
func (this MetadataOriginIndexKey) WithOrigin(origin string) MetadataOriginIndexKey {
|
||||
this.vs = []interface{}{origin}
|
||||
return this
|
||||
}
|
||||
|
||||
type exampleDataTable struct {
|
||||
table ormtable.Table
|
||||
type metadataTable struct {
|
||||
table ormtable.AutoIncrementTable
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Insert(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Insert(ctx, exampleData)
|
||||
func (this metadataTable) Insert(ctx context.Context, metadata *Metadata) error {
|
||||
return this.table.Insert(ctx, metadata)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Update(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Update(ctx, exampleData)
|
||||
func (this metadataTable) Update(ctx context.Context, metadata *Metadata) error {
|
||||
return this.table.Update(ctx, metadata)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Save(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Save(ctx, exampleData)
|
||||
func (this metadataTable) Save(ctx context.Context, metadata *Metadata) error {
|
||||
return this.table.Save(ctx, metadata)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Delete(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Delete(ctx, exampleData)
|
||||
func (this metadataTable) Delete(ctx context.Context, metadata *Metadata) error {
|
||||
return this.table.Delete(ctx, metadata)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Has(ctx context.Context, account []byte) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, account)
|
||||
func (this metadataTable) InsertReturningId(ctx context.Context, metadata *Metadata) (uint64, error) {
|
||||
return this.table.InsertReturningPKey(ctx, metadata)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Get(ctx context.Context, account []byte) (*ExampleData, error) {
|
||||
var exampleData ExampleData
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &exampleData, account)
|
||||
func (this metadataTable) LastInsertedSequence(ctx context.Context) (uint64, error) {
|
||||
return this.table.LastInsertedSequence(ctx)
|
||||
}
|
||||
|
||||
func (this metadataTable) Has(ctx context.Context, id uint64) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, id)
|
||||
}
|
||||
|
||||
func (this metadataTable) Get(ctx context.Context, id uint64) (*Metadata, error) {
|
||||
var metadata Metadata
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &metadata, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &exampleData, nil
|
||||
return &metadata, nil
|
||||
}
|
||||
|
||||
func (this exampleDataTable) List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) {
|
||||
func (this metadataTable) HasByOrigin(ctx context.Context, origin string) (found bool, err error) {
|
||||
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
|
||||
origin,
|
||||
)
|
||||
}
|
||||
|
||||
func (this metadataTable) GetByOrigin(ctx context.Context, origin string) (*Metadata, error) {
|
||||
var metadata Metadata
|
||||
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &metadata,
|
||||
origin,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &metadata, nil
|
||||
}
|
||||
|
||||
func (this metadataTable) List(ctx context.Context, prefixKey MetadataIndexKey, opts ...ormlist.Option) (MetadataIterator, error) {
|
||||
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
|
||||
return ExampleDataIterator{it}, err
|
||||
return MetadataIterator{it}, err
|
||||
}
|
||||
|
||||
func (this exampleDataTable) ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) {
|
||||
func (this metadataTable) ListRange(ctx context.Context, from, to MetadataIndexKey, opts ...ormlist.Option) (MetadataIterator, error) {
|
||||
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
|
||||
return ExampleDataIterator{it}, err
|
||||
return MetadataIterator{it}, err
|
||||
}
|
||||
|
||||
func (this exampleDataTable) DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error {
|
||||
func (this metadataTable) DeleteBy(ctx context.Context, prefixKey MetadataIndexKey) error {
|
||||
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error {
|
||||
func (this metadataTable) DeleteRange(ctx context.Context, from, to MetadataIndexKey) error {
|
||||
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||
}
|
||||
|
||||
func (this exampleDataTable) doNotImplement() {}
|
||||
func (this metadataTable) doNotImplement() {}
|
||||
|
||||
var _ ExampleDataTable = exampleDataTable{}
|
||||
var _ MetadataTable = metadataTable{}
|
||||
|
||||
func NewExampleDataTable(db ormtable.Schema) (ExampleDataTable, error) {
|
||||
table := db.GetTable(&ExampleData{})
|
||||
func NewMetadataTable(db ormtable.Schema) (MetadataTable, error) {
|
||||
table := db.GetTable(&Metadata{})
|
||||
if table == nil {
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&ExampleData{}).ProtoReflect().Descriptor().FullName()))
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&Metadata{}).ProtoReflect().Descriptor().FullName()))
|
||||
}
|
||||
return exampleDataTable{table}, nil
|
||||
return metadataTable{table.(ormtable.AutoIncrementTable)}, nil
|
||||
}
|
||||
|
||||
type ProfileTable interface {
|
||||
Insert(ctx context.Context, profile *Profile) error
|
||||
Update(ctx context.Context, profile *Profile) error
|
||||
Save(ctx context.Context, profile *Profile) error
|
||||
Delete(ctx context.Context, profile *Profile) error
|
||||
Has(ctx context.Context, id string) (found bool, err error)
|
||||
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
Get(ctx context.Context, id string) (*Profile, error)
|
||||
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
|
||||
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Profile, error)
|
||||
List(ctx context.Context, prefixKey ProfileIndexKey, opts ...ormlist.Option) (ProfileIterator, error)
|
||||
ListRange(ctx context.Context, from, to ProfileIndexKey, opts ...ormlist.Option) (ProfileIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey ProfileIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to ProfileIndexKey) error
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type ProfileIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i ProfileIterator) Value() (*Profile, error) {
|
||||
var profile Profile
|
||||
err := i.UnmarshalMessage(&profile)
|
||||
return &profile, err
|
||||
}
|
||||
|
||||
type ProfileIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
profileIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type ProfilePrimaryKey = ProfileIdIndexKey
|
||||
|
||||
type ProfileIdIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ProfileIdIndexKey) id() uint32 { return 0 }
|
||||
func (x ProfileIdIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ProfileIdIndexKey) profileIndexKey() {}
|
||||
|
||||
func (this ProfileIdIndexKey) WithId(id string) ProfileIdIndexKey {
|
||||
this.vs = []interface{}{id}
|
||||
return this
|
||||
}
|
||||
|
||||
type ProfileSubjectOriginIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ProfileSubjectOriginIndexKey) id() uint32 { return 1 }
|
||||
func (x ProfileSubjectOriginIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ProfileSubjectOriginIndexKey) profileIndexKey() {}
|
||||
|
||||
func (this ProfileSubjectOriginIndexKey) WithSubject(subject string) ProfileSubjectOriginIndexKey {
|
||||
this.vs = []interface{}{subject}
|
||||
return this
|
||||
}
|
||||
|
||||
func (this ProfileSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) ProfileSubjectOriginIndexKey {
|
||||
this.vs = []interface{}{subject, origin}
|
||||
return this
|
||||
}
|
||||
|
||||
type profileTable struct {
|
||||
table ormtable.Table
|
||||
}
|
||||
|
||||
func (this profileTable) Insert(ctx context.Context, profile *Profile) error {
|
||||
return this.table.Insert(ctx, profile)
|
||||
}
|
||||
|
||||
func (this profileTable) Update(ctx context.Context, profile *Profile) error {
|
||||
return this.table.Update(ctx, profile)
|
||||
}
|
||||
|
||||
func (this profileTable) Save(ctx context.Context, profile *Profile) error {
|
||||
return this.table.Save(ctx, profile)
|
||||
}
|
||||
|
||||
func (this profileTable) Delete(ctx context.Context, profile *Profile) error {
|
||||
return this.table.Delete(ctx, profile)
|
||||
}
|
||||
|
||||
func (this profileTable) Has(ctx context.Context, id string) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, id)
|
||||
}
|
||||
|
||||
func (this profileTable) Get(ctx context.Context, id string) (*Profile, error) {
|
||||
var profile Profile
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &profile, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &profile, nil
|
||||
}
|
||||
|
||||
func (this profileTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
|
||||
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
|
||||
subject,
|
||||
origin,
|
||||
)
|
||||
}
|
||||
|
||||
func (this profileTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Profile, error) {
|
||||
var profile Profile
|
||||
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &profile,
|
||||
subject,
|
||||
origin,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &profile, nil
|
||||
}
|
||||
|
||||
func (this profileTable) List(ctx context.Context, prefixKey ProfileIndexKey, opts ...ormlist.Option) (ProfileIterator, error) {
|
||||
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
|
||||
return ProfileIterator{it}, err
|
||||
}
|
||||
|
||||
func (this profileTable) ListRange(ctx context.Context, from, to ProfileIndexKey, opts ...ormlist.Option) (ProfileIterator, error) {
|
||||
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
|
||||
return ProfileIterator{it}, err
|
||||
}
|
||||
|
||||
func (this profileTable) DeleteBy(ctx context.Context, prefixKey ProfileIndexKey) error {
|
||||
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||
}
|
||||
|
||||
func (this profileTable) DeleteRange(ctx context.Context, from, to ProfileIndexKey) error {
|
||||
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||
}
|
||||
|
||||
func (this profileTable) doNotImplement() {}
|
||||
|
||||
var _ ProfileTable = profileTable{}
|
||||
|
||||
func NewProfileTable(db ormtable.Schema) (ProfileTable, error) {
|
||||
table := db.GetTable(&Profile{})
|
||||
if table == nil {
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&Profile{}).ProtoReflect().Descriptor().FullName()))
|
||||
}
|
||||
return profileTable{table}, nil
|
||||
}
|
||||
|
||||
type StateStore interface {
|
||||
ExampleDataTable() ExampleDataTable
|
||||
MetadataTable() MetadataTable
|
||||
ProfileTable() ProfileTable
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type stateStore struct {
|
||||
exampleData ExampleDataTable
|
||||
metadata MetadataTable
|
||||
profile ProfileTable
|
||||
}
|
||||
|
||||
func (x stateStore) ExampleDataTable() ExampleDataTable {
|
||||
return x.exampleData
|
||||
func (x stateStore) MetadataTable() MetadataTable {
|
||||
return x.metadata
|
||||
}
|
||||
|
||||
func (x stateStore) ProfileTable() ProfileTable {
|
||||
return x.profile
|
||||
}
|
||||
|
||||
func (stateStore) doNotImplement() {}
|
||||
@@ -155,12 +351,18 @@ func (stateStore) doNotImplement() {}
|
||||
var _ StateStore = stateStore{}
|
||||
|
||||
func NewStateStore(db ormtable.Schema) (StateStore, error) {
|
||||
exampleDataTable, err := NewExampleDataTable(db)
|
||||
metadataTable, err := NewMetadataTable(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
profileTable, err := NewProfileTable(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return stateStore{
|
||||
exampleDataTable,
|
||||
metadataTable,
|
||||
profileTable,
|
||||
}, nil
|
||||
}
|
||||
|
||||
+1878
-156
File diff suppressed because it is too large
Load Diff
+1148
-34
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,8 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Msg_UpdateParams_FullMethodName = "/service.v1.Msg/UpdateParams"
|
||||
Msg_UpdateParams_FullMethodName = "/service.v1.Msg/UpdateParams"
|
||||
Msg_RegisterService_FullMethodName = "/service.v1.Msg/RegisterService"
|
||||
)
|
||||
|
||||
// MsgClient is the client API for Msg service.
|
||||
@@ -30,6 +31,9 @@ type MsgClient interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
// RegisterService initializes a Service with a given permission scope and
|
||||
// URI. The domain must have a valid TXT record containing the public key.
|
||||
RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@@ -49,6 +53,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error) {
|
||||
out := new(MsgRegisterServiceResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_RegisterService_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
// All implementations must embed UnimplementedMsgServer
|
||||
// for forward compatibility
|
||||
@@ -57,6 +70,9 @@ type MsgServer interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
// RegisterService initializes a Service with a given permission scope and
|
||||
// URI. The domain must have a valid TXT record containing the public key.
|
||||
RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
@@ -67,6 +83,9 @@ type UnimplementedMsgServer struct {
|
||||
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
|
||||
|
||||
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
|
||||
@@ -98,6 +117,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_RegisterService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgRegisterService)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).RegisterService(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_RegisterService_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).RegisterService(ctx, req.(*MsgRegisterService))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -109,6 +146,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RegisterService",
|
||||
Handler: _Msg_RegisterService_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service/v1/tx.proto",
|
||||
|
||||
Reference in New Issue
Block a user