merkle

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2024 License: GPL-3.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package merkle is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Query_Proof_FullMethodName             = "/galactica.merkle.Query/Proof"
	Query_GetEmptyLeafProof_FullMethodName = "/galactica.merkle.Query/GetEmptyLeafProof"
)

Variables

View Source
var File_galactica_merkle_query_proto protoreflect.FileDescriptor
View Source
var Query_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "galactica.merkle.Query",
	HandlerType: (*QueryServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Proof",
			Handler:    _Query_Proof_Handler,
		},
		{
			MethodName: "GetEmptyLeafProof",
			Handler:    _Query_GetEmptyLeafProof_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "galactica/merkle/query.proto",
}

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)

Functions

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer)

Types

type GetEmptyLeafProofRequest

type GetEmptyLeafProofRequest struct {

	// registry is the ZkCertificateRegistry hex address, which starts with 0x.
	Registry string `protobuf:"bytes,1,opt,name=registry,proto3" json:"registry,omitempty"`
	// contains filtered or unexported fields
}

GetEmptyLeafProofRequest is the request type for the Query.GetEmptyLeafProof method.

func (*GetEmptyLeafProofRequest) Descriptor deprecated

func (*GetEmptyLeafProofRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetEmptyLeafProofRequest.ProtoReflect.Descriptor instead.

func (*GetEmptyLeafProofRequest) GetRegistry

func (x *GetEmptyLeafProofRequest) GetRegistry() string

func (*GetEmptyLeafProofRequest) ProtoMessage

func (*GetEmptyLeafProofRequest) ProtoMessage()

func (*GetEmptyLeafProofRequest) ProtoReflect

func (x *GetEmptyLeafProofRequest) ProtoReflect() protoreflect.Message

func (*GetEmptyLeafProofRequest) Reset

func (x *GetEmptyLeafProofRequest) Reset()

func (*GetEmptyLeafProofRequest) String

func (x *GetEmptyLeafProofRequest) String() string

type GetEmptyLeafProofResponse

type GetEmptyLeafProofResponse struct {

	// proof is the merkle proof of the empty leaf.
	Proof *Proof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"`
	// contains filtered or unexported fields
}

GetEmptyIndexResponse is the response type for the Query.GetEmptyLeafProof method.

func (*GetEmptyLeafProofResponse) Descriptor deprecated

func (*GetEmptyLeafProofResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetEmptyLeafProofResponse.ProtoReflect.Descriptor instead.

func (*GetEmptyLeafProofResponse) GetProof

func (x *GetEmptyLeafProofResponse) GetProof() *Proof

func (*GetEmptyLeafProofResponse) ProtoMessage

func (*GetEmptyLeafProofResponse) ProtoMessage()

func (*GetEmptyLeafProofResponse) ProtoReflect

func (*GetEmptyLeafProofResponse) Reset

func (x *GetEmptyLeafProofResponse) Reset()

func (*GetEmptyLeafProofResponse) String

func (x *GetEmptyLeafProofResponse) String() string

type Proof

type Proof struct {

	// leaf is the leaf value encoded as a string containing the uint256 value.
	Leaf string `protobuf:"bytes,1,opt,name=leaf,proto3" json:"leaf,omitempty"`
	// path is the merkle proof path, encoded as a string containing the uint256 values.
	Path []string `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"`
	// index is the leaf index.
	Index uint32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"`
	// root is the merkle root, value encoded as a string containing the uint256 value.
	Root string `protobuf:"bytes,4,opt,name=root,proto3" json:"root,omitempty"`
	// contains filtered or unexported fields
}

Proof is the merkle proof.

func (*Proof) Descriptor deprecated

func (*Proof) Descriptor() ([]byte, []int)

Deprecated: Use Proof.ProtoReflect.Descriptor instead.

func (*Proof) GetIndex

func (x *Proof) GetIndex() uint32

func (*Proof) GetLeaf

func (x *Proof) GetLeaf() string

func (*Proof) GetPath

func (x *Proof) GetPath() []string

func (*Proof) GetRoot

func (x *Proof) GetRoot() string

func (*Proof) ProtoMessage

func (*Proof) ProtoMessage()

func (*Proof) ProtoReflect

func (x *Proof) ProtoReflect() protoreflect.Message

func (*Proof) Reset

func (x *Proof) Reset()

func (*Proof) String

func (x *Proof) String() string

type QueryClient

type QueryClient interface {
	// Proof queries the proof of a leaf in the merkle tree.
	Proof(ctx context.Context, in *QueryProofRequest, opts ...grpc.CallOption) (*QueryProofResponse, error)
	// GetEmptyLeafProof queries the proof of the any empty leaf in the merkle tree.
	GetEmptyLeafProof(ctx context.Context, in *GetEmptyLeafProofRequest, opts ...grpc.CallOption) (*GetEmptyLeafProofResponse, error)
}

QueryClient is the client API for Query 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 NewQueryClient

func NewQueryClient(cc grpc.ClientConnInterface) QueryClient

type QueryProofRequest

type QueryProofRequest struct {

	// registry  is the ZkCertificateRegistry hex address, which starts with 0x.
	Registry string `protobuf:"bytes,1,opt,name=registry,proto3" json:"registry,omitempty"`
	// leaf is the leaf uint256 value.
	Leaf string `protobuf:"bytes,2,opt,name=leaf,proto3" json:"leaf,omitempty"`
	// contains filtered or unexported fields
}

QueryProofRequest is the request type for the Query.Proof method.

func (*QueryProofRequest) Descriptor deprecated

func (*QueryProofRequest) Descriptor() ([]byte, []int)

Deprecated: Use QueryProofRequest.ProtoReflect.Descriptor instead.

func (*QueryProofRequest) GetLeaf

func (x *QueryProofRequest) GetLeaf() string

func (*QueryProofRequest) GetRegistry

func (x *QueryProofRequest) GetRegistry() string

func (*QueryProofRequest) ProtoMessage

func (*QueryProofRequest) ProtoMessage()

func (*QueryProofRequest) ProtoReflect

func (x *QueryProofRequest) ProtoReflect() protoreflect.Message

func (*QueryProofRequest) Reset

func (x *QueryProofRequest) Reset()

func (*QueryProofRequest) String

func (x *QueryProofRequest) String() string

type QueryProofResponse

type QueryProofResponse struct {

	// proof is the merkle proof.
	Proof *Proof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"`
	// contains filtered or unexported fields
}

QueryProofResponse is the response type for the Query.Proof method.

func (*QueryProofResponse) Descriptor deprecated

func (*QueryProofResponse) Descriptor() ([]byte, []int)

Deprecated: Use QueryProofResponse.ProtoReflect.Descriptor instead.

func (*QueryProofResponse) GetProof

func (x *QueryProofResponse) GetProof() *Proof

func (*QueryProofResponse) ProtoMessage

func (*QueryProofResponse) ProtoMessage()

func (*QueryProofResponse) ProtoReflect

func (x *QueryProofResponse) ProtoReflect() protoreflect.Message

func (*QueryProofResponse) Reset

func (x *QueryProofResponse) Reset()

func (*QueryProofResponse) String

func (x *QueryProofResponse) String() string

type QueryServer

type QueryServer interface {
	// Proof queries the proof of a leaf in the merkle tree.
	Proof(context.Context, *QueryProofRequest) (*QueryProofResponse, error)
	// GetEmptyLeafProof queries the proof of the any empty leaf in the merkle tree.
	GetEmptyLeafProof(context.Context, *GetEmptyLeafProofRequest) (*GetEmptyLeafProofResponse, error)
	// contains filtered or unexported methods
}

QueryServer is the server API for Query service. All implementations must embed UnimplementedQueryServer for forward compatibility

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer must be embedded to have forward compatible implementations.

func (UnimplementedQueryServer) Proof

type UnsafeQueryServer

type UnsafeQueryServer interface {
	// contains filtered or unexported methods
}

UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to QueryServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL