gen

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package gen is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_proto_imp_api_ipfs_ipfs_proto protoreflect.FileDescriptor

Functions

func RegisterIPFSHandler

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

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

func RegisterIPFSHandlerClient

func RegisterIPFSHandlerClient(ctx context.Context, mux *runtime.ServeMux, client IPFSClient) error

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

func RegisterIPFSHandlerFromEndpoint

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

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

func RegisterIPFSHandlerServer

func RegisterIPFSHandlerServer(ctx context.Context, mux *runtime.ServeMux, server IPFSServer) error

RegisterIPFSHandlerServer registers the http handlers for service IPFS to "mux". UnaryRPC :call IPFSServer 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 RegisterIPFSHandlerFromEndpoint instead.

func RegisterIPFSServer

func RegisterIPFSServer(s *grpc.Server, srv IPFSServer)

Types

type AddFileRequest

type AddFileRequest struct {
	Name      string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`            // The name of the file to add
	Data      []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`            // The data content of the file to add
	Updatable bool   `protobuf:"varint,3,opt,name=updatable,proto3" json:"updatable,omitempty"` // Whether or not the file should be updatable
	// contains filtered or unexported fields
}

* Represents a request to add a file to IPFS.

func (*AddFileRequest) Descriptor deprecated

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

Deprecated: Use AddFileRequest.ProtoReflect.Descriptor instead.

func (*AddFileRequest) GetData

func (x *AddFileRequest) GetData() []byte

func (*AddFileRequest) GetName

func (x *AddFileRequest) GetName() string

func (*AddFileRequest) GetUpdatable

func (x *AddFileRequest) GetUpdatable() bool

func (*AddFileRequest) ProtoMessage

func (*AddFileRequest) ProtoMessage()

func (*AddFileRequest) ProtoReflect

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

func (*AddFileRequest) Reset

func (x *AddFileRequest) Reset()

func (*AddFileRequest) String

func (x *AddFileRequest) String() string

type AddFileResponse

type AddFileResponse struct {
	Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` // The content ID of the added file
	// contains filtered or unexported fields
}

* Represents a response containing the content ID of the added IPFS file.

func (*AddFileResponse) Descriptor deprecated

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

Deprecated: Use AddFileResponse.ProtoReflect.Descriptor instead.

func (*AddFileResponse) GetCid

func (x *AddFileResponse) GetCid() string

func (*AddFileResponse) ProtoMessage

func (*AddFileResponse) ProtoMessage()

func (*AddFileResponse) ProtoReflect

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

func (*AddFileResponse) Reset

func (x *AddFileResponse) Reset()

func (*AddFileResponse) String

func (x *AddFileResponse) String() string

type GetFileRequest

type GetFileRequest struct {
	Protocol string `protobuf:"bytes,1,opt,name=protocol,proto3" json:"protocol,omitempty"` // The optional ipfs protocol to use (ex ipns or ipfs, default ipfs)
	Cid      string `protobuf:"bytes,2,opt,name=cid,proto3" json:"cid,omitempty"`           // The cid of the file to get
	// contains filtered or unexported fields
}

* Represents a request to get a file from IPFS.

func (*GetFileRequest) Descriptor deprecated

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

Deprecated: Use GetFileRequest.ProtoReflect.Descriptor instead.

func (*GetFileRequest) GetCid

func (x *GetFileRequest) GetCid() string

func (*GetFileRequest) GetProtocol

func (x *GetFileRequest) GetProtocol() string

func (*GetFileRequest) ProtoMessage

func (*GetFileRequest) ProtoMessage()

func (*GetFileRequest) ProtoReflect

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

func (*GetFileRequest) Reset

func (x *GetFileRequest) Reset()

func (*GetFileRequest) String

func (x *GetFileRequest) String() string

type GetFileResponse

type GetFileResponse struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // The contents of the file
	// contains filtered or unexported fields
}

* Represents a response containing the contents of the retrieved file.

func (*GetFileResponse) Descriptor deprecated

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

Deprecated: Use GetFileResponse.ProtoReflect.Descriptor instead.

func (*GetFileResponse) GetData

func (x *GetFileResponse) GetData() []byte

func (*GetFileResponse) ProtoMessage

func (*GetFileResponse) ProtoMessage()

func (*GetFileResponse) ProtoReflect

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

func (*GetFileResponse) Reset

func (x *GetFileResponse) Reset()

func (*GetFileResponse) String

func (x *GetFileResponse) String() string

type IPFSClient

type IPFSClient interface {
	//*
	// AddFile will add data to a file and pin to IPFS to return it's CID.
	AddFile(ctx context.Context, in *AddFileRequest, opts ...grpc.CallOption) (*AddFileResponse, error)
	//*
	// RetrieveFile will retrieve a file from the IPFS network.
	GetFile(ctx context.Context, in *GetFileRequest, opts ...grpc.CallOption) (*GetFileResponse, error)
	//*
	// ListFiles lists all of the files pinned locally.
	ListFiles(ctx context.Context, in *ListFilesRequest, opts ...grpc.CallOption) (*ListFilesResponse, error)
}

IPFSClient is the client API for IPFS service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewIPFSClient

func NewIPFSClient(cc grpc.ClientConnInterface) IPFSClient

type IPFSServer

type IPFSServer interface {
	//*
	// AddFile will add data to a file and pin to IPFS to return it's CID.
	AddFile(context.Context, *AddFileRequest) (*AddFileResponse, error)
	//*
	// RetrieveFile will retrieve a file from the IPFS network.
	GetFile(context.Context, *GetFileRequest) (*GetFileResponse, error)
	//*
	// ListFiles lists all of the files pinned locally.
	ListFiles(context.Context, *ListFilesRequest) (*ListFilesResponse, error)
}

IPFSServer is the server API for IPFS service.

type ListFilesRequest

type ListFilesRequest struct {
	// contains filtered or unexported fields
}

* Represents a request to list files stored locally.

func (*ListFilesRequest) Descriptor deprecated

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

Deprecated: Use ListFilesRequest.ProtoReflect.Descriptor instead.

func (*ListFilesRequest) ProtoMessage

func (*ListFilesRequest) ProtoMessage()

func (*ListFilesRequest) ProtoReflect

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

func (*ListFilesRequest) Reset

func (x *ListFilesRequest) Reset()

func (*ListFilesRequest) String

func (x *ListFilesRequest) String() string

type ListFilesResponse

type ListFilesResponse struct {
	Files []string `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` // The stored files
	// contains filtered or unexported fields
}

* Represents a response containing a list of the files.

func (*ListFilesResponse) Descriptor deprecated

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

Deprecated: Use ListFilesResponse.ProtoReflect.Descriptor instead.

func (*ListFilesResponse) GetFiles

func (x *ListFilesResponse) GetFiles() []string

func (*ListFilesResponse) ProtoMessage

func (*ListFilesResponse) ProtoMessage()

func (*ListFilesResponse) ProtoReflect

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

func (*ListFilesResponse) Reset

func (x *ListFilesResponse) Reset()

func (*ListFilesResponse) String

func (x *ListFilesResponse) String() string

type UnimplementedIPFSServer

type UnimplementedIPFSServer struct {
}

UnimplementedIPFSServer can be embedded to have forward compatible implementations.

func (*UnimplementedIPFSServer) AddFile

func (*UnimplementedIPFSServer) GetFile

func (*UnimplementedIPFSServer) ListFiles

Jump to

Keyboard shortcuts

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