Documentation
¶
Index ¶
- Constants
- Variables
- func AddBlock(txn *Transaction)
- func InitializeChain()
- func PubsubHandler(ctx context.Context, sub *pubsub.Subscription)
- func RegisterSporeServer(s grpc.ServiceRegistrar, srv SporeServer)
- func StartRPCServer(topic string, pubsub *pubsub.PubSub, p *int)
- type Request
- func (*Request) Descriptor() ([]byte, []int)deprecated
- func (x *Request) GetTransaction() *Transaction
- func (x *Request) GetTransactionId() *TransactionId
- func (x *Request) GetType() Request_Type
- func (*Request) ProtoMessage()
- func (x *Request) ProtoReflect() protoreflect.Message
- func (x *Request) Reset()
- func (x *Request) String() string
- type Request_Type
- func (Request_Type) Descriptor() protoreflect.EnumDescriptor
- func (x Request_Type) Enum() *Request_Type
- func (Request_Type) EnumDescriptor() ([]byte, []int)deprecated
- func (x Request_Type) Number() protoreflect.EnumNumber
- func (x Request_Type) String() string
- func (Request_Type) Type() protoreflect.EnumType
- type SporeClient
- type SporeServer
- type Transaction
- func (*Transaction) Descriptor() ([]byte, []int)deprecated
- func (x *Transaction) GetContract() bool
- func (x *Transaction) GetCreated() int64
- func (x *Transaction) GetData() []byte
- func (x *Transaction) GetFrom() []byte
- func (x *Transaction) GetGas() int64
- func (x *Transaction) GetGasPrice() int64
- func (x *Transaction) GetId() []byte
- func (x *Transaction) GetNonce() int32
- func (x *Transaction) GetSignature() []byte
- func (x *Transaction) GetTo() []byte
- func (*Transaction) ProtoMessage()
- func (x *Transaction) ProtoReflect() protoreflect.Message
- func (x *Transaction) Reset()
- func (x *Transaction) String() string
- type TransactionId
- type TransactionResponse
- func (*TransactionResponse) Descriptor() ([]byte, []int)deprecated
- func (x *TransactionResponse) GetTransactionId() []byte
- func (*TransactionResponse) ProtoMessage()
- func (x *TransactionResponse) ProtoReflect() protoreflect.Message
- func (x *TransactionResponse) Reset()
- func (x *TransactionResponse) String() string
- type UnimplementedSporeServer
- func (UnimplementedSporeServer) CreateContract(context.Context, *Transaction) (*TransactionResponse, error)
- func (UnimplementedSporeServer) GetTransaction(context.Context, *TransactionId) (*Transaction, error)
- func (UnimplementedSporeServer) Send(context.Context, *Transaction) (*TransactionResponse, error)
- type UnsafeSporeServer
Constants ¶
const ( PubsubTopic = "/spore/1.0.0" DatabaseNamespace = "sporedb" )
Variables ¶
var ( Request_Type_name = map[int32]string{ 0: "SEND_TRANSACTION", 1: "CREATE_CONTRACT", } Request_Type_value = map[string]int32{ "SEND_TRANSACTION": 0, "CREATE_CONTRACT": 1, } )
Enum value maps for Request_Type.
var (
Database db.DB
)
var File_spore_proto protoreflect.FileDescriptor
var Spore_ServiceDesc = grpc.ServiceDesc{ ServiceName: "main.Spore", HandlerType: (*SporeServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Send", Handler: _Spore_Send_Handler, }, { MethodName: "CreateContract", Handler: _Spore_CreateContract_Handler, }, { MethodName: "GetTransaction", Handler: _Spore_GetTransaction_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "spore.proto", }
Spore_ServiceDesc is the grpc.ServiceDesc for Spore service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func AddBlock ¶
func AddBlock(txn *Transaction)
func InitializeChain ¶
func InitializeChain()
func PubsubHandler ¶
func PubsubHandler(ctx context.Context, sub *pubsub.Subscription)
func RegisterSporeServer ¶
func RegisterSporeServer(s grpc.ServiceRegistrar, srv SporeServer)
Types ¶
type Request ¶
type Request struct { Type Request_Type `protobuf:"varint,1,opt,name=type,proto3,enum=main.Request_Type" json:"type,omitempty"` Transaction *Transaction `protobuf:"bytes,2,opt,name=transaction,proto3" json:"transaction,omitempty"` TransactionId *TransactionId `protobuf:"bytes,3,opt,name=transactionId,proto3" json:"transactionId,omitempty"` // contains filtered or unexported fields }
func (*Request) Descriptor
deprecated
func (*Request) GetTransaction ¶
func (x *Request) GetTransaction() *Transaction
func (*Request) GetTransactionId ¶
func (x *Request) GetTransactionId() *TransactionId
func (*Request) GetType ¶
func (x *Request) GetType() Request_Type
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Request_Type ¶
type Request_Type int32
const ( Request_SEND_TRANSACTION Request_Type = 0 Request_CREATE_CONTRACT Request_Type = 1 )
func (Request_Type) Descriptor ¶
func (Request_Type) Descriptor() protoreflect.EnumDescriptor
func (Request_Type) Enum ¶
func (x Request_Type) Enum() *Request_Type
func (Request_Type) EnumDescriptor
deprecated
func (Request_Type) EnumDescriptor() ([]byte, []int)
Deprecated: Use Request_Type.Descriptor instead.
func (Request_Type) Number ¶
func (x Request_Type) Number() protoreflect.EnumNumber
func (Request_Type) String ¶
func (x Request_Type) String() string
func (Request_Type) Type ¶
func (Request_Type) Type() protoreflect.EnumType
type SporeClient ¶
type SporeClient interface { // Sends a Transaction Send(ctx context.Context, in *Transaction, opts ...grpc.CallOption) (*TransactionResponse, error) // Sends a Contract CreateContract(ctx context.Context, in *Transaction, opts ...grpc.CallOption) (*TransactionResponse, error) // Get transaction by transaction id GetTransaction(ctx context.Context, in *TransactionId, opts ...grpc.CallOption) (*Transaction, error) }
SporeClient is the client API for Spore service.
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.
func NewSporeClient ¶
func NewSporeClient(cc grpc.ClientConnInterface) SporeClient
type SporeServer ¶
type SporeServer interface { // Sends a Transaction Send(context.Context, *Transaction) (*TransactionResponse, error) // Sends a Contract CreateContract(context.Context, *Transaction) (*TransactionResponse, error) // Get transaction by transaction id GetTransaction(context.Context, *TransactionId) (*Transaction, error) // contains filtered or unexported methods }
SporeServer is the server API for Spore service. All implementations must embed UnimplementedSporeServer for forward compatibility
type Transaction ¶
type Transaction struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` Created int64 `protobuf:"varint,2,opt,name=created,proto3" json:"created,omitempty"` Id []byte `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` To []byte `protobuf:"bytes,4,opt,name=to,proto3" json:"to,omitempty"` From []byte `protobuf:"bytes,5,opt,name=from,proto3" json:"from,omitempty"` Gas int64 `protobuf:"varint,6,opt,name=gas,proto3" json:"gas,omitempty"` GasPrice int64 `protobuf:"varint,7,opt,name=gasPrice,proto3" json:"gasPrice,omitempty"` Nonce int32 `protobuf:"varint,8,opt,name=nonce,proto3" json:"nonce,omitempty"` Contract bool `protobuf:"varint,9,opt,name=contract,proto3" json:"contract,omitempty"` Signature []byte `protobuf:"bytes,10,opt,name=signature,proto3" json:"signature,omitempty"` // contains filtered or unexported fields }
func (*Transaction) Descriptor
deprecated
func (*Transaction) Descriptor() ([]byte, []int)
Deprecated: Use Transaction.ProtoReflect.Descriptor instead.
func (*Transaction) GetContract ¶
func (x *Transaction) GetContract() bool
func (*Transaction) GetCreated ¶
func (x *Transaction) GetCreated() int64
func (*Transaction) GetData ¶
func (x *Transaction) GetData() []byte
func (*Transaction) GetFrom ¶
func (x *Transaction) GetFrom() []byte
func (*Transaction) GetGas ¶
func (x *Transaction) GetGas() int64
func (*Transaction) GetGasPrice ¶
func (x *Transaction) GetGasPrice() int64
func (*Transaction) GetId ¶
func (x *Transaction) GetId() []byte
func (*Transaction) GetNonce ¶
func (x *Transaction) GetNonce() int32
func (*Transaction) GetSignature ¶
func (x *Transaction) GetSignature() []byte
func (*Transaction) GetTo ¶
func (x *Transaction) GetTo() []byte
func (*Transaction) ProtoMessage ¶
func (*Transaction) ProtoMessage()
func (*Transaction) ProtoReflect ¶
func (x *Transaction) ProtoReflect() protoreflect.Message
func (*Transaction) Reset ¶
func (x *Transaction) Reset()
func (*Transaction) String ¶
func (x *Transaction) String() string
type TransactionId ¶
type TransactionId struct { TransactionId []byte `protobuf:"bytes,1,opt,name=transactionId,proto3" json:"transactionId,omitempty"` // contains filtered or unexported fields }
func (*TransactionId) Descriptor
deprecated
func (*TransactionId) Descriptor() ([]byte, []int)
Deprecated: Use TransactionId.ProtoReflect.Descriptor instead.
func (*TransactionId) GetTransactionId ¶
func (x *TransactionId) GetTransactionId() []byte
func (*TransactionId) ProtoMessage ¶
func (*TransactionId) ProtoMessage()
func (*TransactionId) ProtoReflect ¶
func (x *TransactionId) ProtoReflect() protoreflect.Message
func (*TransactionId) Reset ¶
func (x *TransactionId) Reset()
func (*TransactionId) String ¶
func (x *TransactionId) String() string
type TransactionResponse ¶
type TransactionResponse struct { TransactionId []byte `protobuf:"bytes,1,opt,name=transactionId,proto3" json:"transactionId,omitempty"` // contains filtered or unexported fields }
The response message containing the greetings
func (*TransactionResponse) Descriptor
deprecated
func (*TransactionResponse) Descriptor() ([]byte, []int)
Deprecated: Use TransactionResponse.ProtoReflect.Descriptor instead.
func (*TransactionResponse) GetTransactionId ¶
func (x *TransactionResponse) GetTransactionId() []byte
func (*TransactionResponse) ProtoMessage ¶
func (*TransactionResponse) ProtoMessage()
func (*TransactionResponse) ProtoReflect ¶
func (x *TransactionResponse) ProtoReflect() protoreflect.Message
func (*TransactionResponse) Reset ¶
func (x *TransactionResponse) Reset()
func (*TransactionResponse) String ¶
func (x *TransactionResponse) String() string
type UnimplementedSporeServer ¶
type UnimplementedSporeServer struct { }
UnimplementedSporeServer must be embedded to have forward compatible implementations.
func (UnimplementedSporeServer) CreateContract ¶
func (UnimplementedSporeServer) CreateContract(context.Context, *Transaction) (*TransactionResponse, error)
func (UnimplementedSporeServer) GetTransaction ¶
func (UnimplementedSporeServer) GetTransaction(context.Context, *TransactionId) (*Transaction, error)
func (UnimplementedSporeServer) Send ¶
func (UnimplementedSporeServer) Send(context.Context, *Transaction) (*TransactionResponse, error)
type UnsafeSporeServer ¶
type UnsafeSporeServer interface {
// contains filtered or unexported methods
}
UnsafeSporeServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SporeServer will result in compilation errors.