rpc

package
v0.0.0-...-d96d936 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const FcPathPrefix = "/twirp/synctainer.Fc/"

FcPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html

Variables

View Source
var File_synctainer_proto protoreflect.FileDescriptor

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type Fc

type Fc interface {
	// called by fe
	PostTask(context.Context, *ReqPostTask) (*RespPostTask, error)

	GetTask(context.Context, *ReqGetTask) (*RespGetTask, error)

	// called by gh, update non-empty fields
	PatchTask(context.Context, *ReqPatchTask) (*RespPatchTask, error)
}

func NewFcJSONClient

func NewFcJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Fc

NewFcJSONClient creates a JSON client that implements the Fc interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewFcProtobufClient

func NewFcProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Fc

NewFcProtobufClient creates a Protobuf client that implements the Fc interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type ReqGetTask

type ReqGetTask struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*ReqGetTask) Descriptor deprecated

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

Deprecated: Use ReqGetTask.ProtoReflect.Descriptor instead.

func (*ReqGetTask) GetId

func (x *ReqGetTask) GetId() string

func (*ReqGetTask) ProtoMessage

func (*ReqGetTask) ProtoMessage()

func (*ReqGetTask) ProtoReflect

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

func (*ReqGetTask) Reset

func (x *ReqGetTask) Reset()

func (*ReqGetTask) String

func (x *ReqGetTask) String() string

type ReqPatchTask

type ReqPatchTask struct {
	Id                string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Digest            string `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"`
	GithubActionRunId string `protobuf:"bytes,3,opt,name=github_action_run_id,json=githubActionRunId,proto3" json:"github_action_run_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ReqPatchTask) Descriptor deprecated

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

Deprecated: Use ReqPatchTask.ProtoReflect.Descriptor instead.

func (*ReqPatchTask) GetDigest

func (x *ReqPatchTask) GetDigest() string

func (*ReqPatchTask) GetGithubActionRunId

func (x *ReqPatchTask) GetGithubActionRunId() string

func (*ReqPatchTask) GetId

func (x *ReqPatchTask) GetId() string

func (*ReqPatchTask) ProtoMessage

func (*ReqPatchTask) ProtoMessage()

func (*ReqPatchTask) ProtoReflect

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

func (*ReqPatchTask) Reset

func (x *ReqPatchTask) Reset()

func (*ReqPatchTask) String

func (x *ReqPatchTask) String() string

type ReqPostTask

type ReqPostTask struct {
	Image       string `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	Platform    string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform,omitempty"`
	TargetImage string `protobuf:"bytes,3,opt,name=targetImage,proto3" json:"targetImage,omitempty"`
	Username    string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"`
	Password    string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*ReqPostTask) Descriptor deprecated

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

Deprecated: Use ReqPostTask.ProtoReflect.Descriptor instead.

func (*ReqPostTask) GetImage

func (x *ReqPostTask) GetImage() string

func (*ReqPostTask) GetPassword

func (x *ReqPostTask) GetPassword() string

func (*ReqPostTask) GetPlatform

func (x *ReqPostTask) GetPlatform() string

func (*ReqPostTask) GetTargetImage

func (x *ReqPostTask) GetTargetImage() string

func (*ReqPostTask) GetUsername

func (x *ReqPostTask) GetUsername() string

func (*ReqPostTask) ProtoMessage

func (*ReqPostTask) ProtoMessage()

func (*ReqPostTask) ProtoReflect

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

func (*ReqPostTask) Reset

func (x *ReqPostTask) Reset()

func (*ReqPostTask) String

func (x *ReqPostTask) String() string

type RespGetTask

type RespGetTask struct {
	Digest          string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
	GithubActionUrl string `protobuf:"bytes,2,opt,name=github_action_url,json=githubActionUrl,proto3" json:"github_action_url,omitempty"`
	// contains filtered or unexported fields
}

func (*RespGetTask) Descriptor deprecated

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

Deprecated: Use RespGetTask.ProtoReflect.Descriptor instead.

func (*RespGetTask) GetDigest

func (x *RespGetTask) GetDigest() string

func (*RespGetTask) GetGithubActionUrl

func (x *RespGetTask) GetGithubActionUrl() string

func (*RespGetTask) ProtoMessage

func (*RespGetTask) ProtoMessage()

func (*RespGetTask) ProtoReflect

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

func (*RespGetTask) Reset

func (x *RespGetTask) Reset()

func (*RespGetTask) String

func (x *RespGetTask) String() string

type RespPatchTask

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

func (*RespPatchTask) Descriptor deprecated

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

Deprecated: Use RespPatchTask.ProtoReflect.Descriptor instead.

func (*RespPatchTask) ProtoMessage

func (*RespPatchTask) ProtoMessage()

func (*RespPatchTask) ProtoReflect

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

func (*RespPatchTask) Reset

func (x *RespPatchTask) Reset()

func (*RespPatchTask) String

func (x *RespPatchTask) String() string

type RespPostTask

type RespPostTask struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // run id for the sync task
	TagImage string `protobuf:"bytes,2,opt,name=tagImage,proto3" json:"tagImage,omitempty"`
	// contains filtered or unexported fields
}

func (*RespPostTask) Descriptor deprecated

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

Deprecated: Use RespPostTask.ProtoReflect.Descriptor instead.

func (*RespPostTask) GetId

func (x *RespPostTask) GetId() string

func (*RespPostTask) GetTagImage

func (x *RespPostTask) GetTagImage() string

func (*RespPostTask) ProtoMessage

func (*RespPostTask) ProtoMessage()

func (*RespPostTask) ProtoReflect

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

func (*RespPostTask) Reset

func (x *RespPostTask) Reset()

func (*RespPostTask) String

func (x *RespPostTask) String() string

type TwirpServer

type TwirpServer interface {
	http.Handler

	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)

	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string

	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route Twirp requests.
	// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
	// that is, everything in a Twirp route except for the <Method> at the end.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewFcServer

func NewFcServer(svc Fc, opts ...interface{}) TwirpServer

NewFcServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).

Jump to

Keyboard shortcuts

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