replicant

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const ReplicationPathPrefix = "/twirp/elephant.replicant.Replication/"

ReplicationPathPrefix 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 (
	TargetAction_name = map[int32]string{
		0: "TARGET_ACTION_UNSPECIFIED",
		1: "TARGET_ACTION_START",
		2: "TARGET_ACTION_STOP",
	}
	TargetAction_value = map[string]int32{
		"TARGET_ACTION_UNSPECIFIED": 0,
		"TARGET_ACTION_START":       1,
		"TARGET_ACTION_STOP":        2,
	}
)

Enum value maps for TargetAction.

View Source
var (
	TargetState_name = map[int32]string{
		0: "TARGET_STATE_UNSPECIFIED",
		1: "TARGET_STATE_RUNNING",
		2: "TARGET_STATE_STARTING",
		3: "TARGET_STATE_STOPPING",
		4: "TARGET_STATE_STOPPED",
	}
	TargetState_value = map[string]int32{
		"TARGET_STATE_UNSPECIFIED": 0,
		"TARGET_STATE_RUNNING":     1,
		"TARGET_STATE_STARTING":    2,
		"TARGET_STATE_STOPPING":    3,
		"TARGET_STATE_STOPPED":     4,
	}
)

Enum value maps for TargetState.

View Source
var File_replicant_service_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 AttachmentForType added in v0.22.0

type AttachmentForType struct {

	// The attachment name, e.g. "image".
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// The document type, e.g. "core/image".
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

AttachmentForType identifies an attachment to include for a specific document type. Format in environment variable: "name.type", e.g. "image.core/image".

func (*AttachmentForType) Descriptor deprecated added in v0.22.0

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

Deprecated: Use AttachmentForType.ProtoReflect.Descriptor instead.

func (*AttachmentForType) GetName added in v0.22.0

func (x *AttachmentForType) GetName() string

func (*AttachmentForType) GetType added in v0.22.0

func (x *AttachmentForType) GetType() string

func (*AttachmentForType) ProtoMessage added in v0.22.0

func (*AttachmentForType) ProtoMessage()

func (*AttachmentForType) ProtoReflect added in v0.22.0

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

func (*AttachmentForType) Reset added in v0.22.0

func (x *AttachmentForType) Reset()

func (*AttachmentForType) String added in v0.22.0

func (x *AttachmentForType) String() string

type ChangeTargetStateRequest added in v0.22.0

type ChangeTargetStateRequest struct {

	// Name of the replication target.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The action to perform on the target.
	Action TargetAction `protobuf:"varint,2,opt,name=action,proto3,enum=elephant.replicant.TargetAction" json:"action,omitempty"`
	// contains filtered or unexported fields
}

func (*ChangeTargetStateRequest) Descriptor deprecated added in v0.22.0

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

Deprecated: Use ChangeTargetStateRequest.ProtoReflect.Descriptor instead.

func (*ChangeTargetStateRequest) GetAction added in v0.22.0

func (x *ChangeTargetStateRequest) GetAction() TargetAction

func (*ChangeTargetStateRequest) GetName added in v0.22.0

func (x *ChangeTargetStateRequest) GetName() string

func (*ChangeTargetStateRequest) ProtoMessage added in v0.22.0

func (*ChangeTargetStateRequest) ProtoMessage()

func (*ChangeTargetStateRequest) ProtoReflect added in v0.22.0

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

func (*ChangeTargetStateRequest) Reset added in v0.22.0

func (x *ChangeTargetStateRequest) Reset()

func (*ChangeTargetStateRequest) String added in v0.22.0

func (x *ChangeTargetStateRequest) String() string

type ChangeTargetStateResponse added in v0.22.0

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

func (*ChangeTargetStateResponse) Descriptor deprecated added in v0.22.0

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

Deprecated: Use ChangeTargetStateResponse.ProtoReflect.Descriptor instead.

func (*ChangeTargetStateResponse) ProtoMessage added in v0.22.0

func (*ChangeTargetStateResponse) ProtoMessage()

func (*ChangeTargetStateResponse) ProtoReflect added in v0.22.0

func (*ChangeTargetStateResponse) Reset added in v0.22.0

func (x *ChangeTargetStateResponse) Reset()

func (*ChangeTargetStateResponse) String added in v0.22.0

func (x *ChangeTargetStateResponse) String() string

type ConfigureTargetRequest added in v0.22.0

type ConfigureTargetRequest struct {

	// Name is the identifier for the replication target.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The URL of the target repository to replicate to.
	RepositoryUrl string `protobuf:"bytes,2,opt,name=repository_url,json=repositoryUrl,proto3" json:"repository_url,omitempty"`
	// The OIDC discovery configuration URL for target authentication.
	OidcConfig string `protobuf:"bytes,3,opt,name=oidc_config,json=oidcConfig,proto3" json:"oidc_config,omitempty"`
	// The OAuth2 client ID for target authentication.
	ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
	// The OAuth2 client secret for target authentication.
	ClientSecret string `protobuf:"bytes,5,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"`
	// The event log position to start replication from.
	StartFrom int64 `protobuf:"varint,6,opt,name=start_from,json=startFrom,proto3" json:"start_from,omitempty"`
	// Sync configuration controlling what gets replicated.
	Config *SyncConfig `protobuf:"bytes,7,opt,name=config,proto3" json:"config,omitempty"`
	// contains filtered or unexported fields
}

ConfigureTargetRequest creates or updates a replication target.

func (*ConfigureTargetRequest) Descriptor deprecated added in v0.22.0

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

Deprecated: Use ConfigureTargetRequest.ProtoReflect.Descriptor instead.

func (*ConfigureTargetRequest) GetClientId added in v0.22.0

func (x *ConfigureTargetRequest) GetClientId() string

func (*ConfigureTargetRequest) GetClientSecret added in v0.22.0

func (x *ConfigureTargetRequest) GetClientSecret() string

func (*ConfigureTargetRequest) GetConfig added in v0.22.0

func (x *ConfigureTargetRequest) GetConfig() *SyncConfig

func (*ConfigureTargetRequest) GetName added in v0.22.0

func (x *ConfigureTargetRequest) GetName() string

func (*ConfigureTargetRequest) GetOidcConfig added in v0.22.0

func (x *ConfigureTargetRequest) GetOidcConfig() string

func (*ConfigureTargetRequest) GetRepositoryUrl added in v0.22.0

func (x *ConfigureTargetRequest) GetRepositoryUrl() string

func (*ConfigureTargetRequest) GetStartFrom added in v0.22.0

func (x *ConfigureTargetRequest) GetStartFrom() int64

func (*ConfigureTargetRequest) ProtoMessage added in v0.22.0

func (*ConfigureTargetRequest) ProtoMessage()

func (*ConfigureTargetRequest) ProtoReflect added in v0.22.0

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

func (*ConfigureTargetRequest) Reset added in v0.22.0

func (x *ConfigureTargetRequest) Reset()

func (*ConfigureTargetRequest) String added in v0.22.0

func (x *ConfigureTargetRequest) String() string

type ConfigureTargetResponse added in v0.22.0

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

func (*ConfigureTargetResponse) Descriptor deprecated added in v0.22.0

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

Deprecated: Use ConfigureTargetResponse.ProtoReflect.Descriptor instead.

func (*ConfigureTargetResponse) ProtoMessage added in v0.22.0

func (*ConfigureTargetResponse) ProtoMessage()

func (*ConfigureTargetResponse) ProtoReflect added in v0.22.0

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

func (*ConfigureTargetResponse) Reset added in v0.22.0

func (x *ConfigureTargetResponse) Reset()

func (*ConfigureTargetResponse) String added in v0.22.0

func (x *ConfigureTargetResponse) String() string

type GetTargetStateRequest added in v0.22.0

type GetTargetStateRequest struct {

	// Name of the replication target.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*GetTargetStateRequest) Descriptor deprecated added in v0.22.0

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

Deprecated: Use GetTargetStateRequest.ProtoReflect.Descriptor instead.

func (*GetTargetStateRequest) GetName added in v0.22.0

func (x *GetTargetStateRequest) GetName() string

func (*GetTargetStateRequest) ProtoMessage added in v0.22.0

func (*GetTargetStateRequest) ProtoMessage()

func (*GetTargetStateRequest) ProtoReflect added in v0.22.0

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

func (*GetTargetStateRequest) Reset added in v0.22.0

func (x *GetTargetStateRequest) Reset()

func (*GetTargetStateRequest) String added in v0.22.0

func (x *GetTargetStateRequest) String() string

type GetTargetStateResponse added in v0.22.0

type GetTargetStateResponse struct {

	// The current state of the replication target.
	State TargetState `protobuf:"varint,1,opt,name=state,proto3,enum=elephant.replicant.TargetState" json:"state,omitempty"`
	// contains filtered or unexported fields
}

func (*GetTargetStateResponse) Descriptor deprecated added in v0.22.0

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

Deprecated: Use GetTargetStateResponse.ProtoReflect.Descriptor instead.

func (*GetTargetStateResponse) GetState added in v0.22.0

func (x *GetTargetStateResponse) GetState() TargetState

func (*GetTargetStateResponse) ProtoMessage added in v0.22.0

func (*GetTargetStateResponse) ProtoMessage()

func (*GetTargetStateResponse) ProtoReflect added in v0.22.0

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

func (*GetTargetStateResponse) Reset added in v0.22.0

func (x *GetTargetStateResponse) Reset()

func (*GetTargetStateResponse) String added in v0.22.0

func (x *GetTargetStateResponse) String() string

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 RemoveTargetRequest added in v0.22.0

type RemoveTargetRequest struct {

	// Name of the replication target to remove.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*RemoveTargetRequest) Descriptor deprecated added in v0.22.0

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

Deprecated: Use RemoveTargetRequest.ProtoReflect.Descriptor instead.

func (*RemoveTargetRequest) GetName added in v0.22.0

func (x *RemoveTargetRequest) GetName() string

func (*RemoveTargetRequest) ProtoMessage added in v0.22.0

func (*RemoveTargetRequest) ProtoMessage()

func (*RemoveTargetRequest) ProtoReflect added in v0.22.0

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

func (*RemoveTargetRequest) Reset added in v0.22.0

func (x *RemoveTargetRequest) Reset()

func (*RemoveTargetRequest) String added in v0.22.0

func (x *RemoveTargetRequest) String() string

type RemoveTargetResponse added in v0.22.0

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

func (*RemoveTargetResponse) Descriptor deprecated added in v0.22.0

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

Deprecated: Use RemoveTargetResponse.ProtoReflect.Descriptor instead.

func (*RemoveTargetResponse) ProtoMessage added in v0.22.0

func (*RemoveTargetResponse) ProtoMessage()

func (*RemoveTargetResponse) ProtoReflect added in v0.22.0

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

func (*RemoveTargetResponse) Reset added in v0.22.0

func (x *RemoveTargetResponse) Reset()

func (*RemoveTargetResponse) String added in v0.22.0

func (x *RemoveTargetResponse) String() string

type Replication

type Replication interface {
	// SendDocument triggers replication of a single document by UUID.
	SendDocument(context.Context, *SendDocumentRequest) (*SendDocumentResponse, error)

	// ConfigureTarget creates or updates a replication target. The configuration
	// maps to the environment variables used for static configuration in
	// elephant-replicant.
	ConfigureTarget(context.Context, *ConfigureTargetRequest) (*ConfigureTargetResponse, error)

	// RemoveTarget deletes a replication target and stops its replication.
	RemoveTarget(context.Context, *RemoveTargetRequest) (*RemoveTargetResponse, error)

	// ChangeTargetState starts or stops a replication target.
	ChangeTargetState(context.Context, *ChangeTargetStateRequest) (*ChangeTargetStateResponse, error)

	// GetTargetState returns the current state of a replication target.
	GetTargetState(context.Context, *GetTargetStateRequest) (*GetTargetStateResponse, error)
}

Replication manages document replication between Elephant repository instances. A replication target follows the source repository event log and replicates documents to a target repository.

func NewReplicationJSONClient

func NewReplicationJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Replication

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

func NewReplicationProtobufClient

func NewReplicationProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Replication

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

type SectionForType added in v0.22.0

type SectionForType struct {

	// The document type, e.g. "core/event".
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// The UUID of the section to ignore.
	SectionUuid string `protobuf:"bytes,2,opt,name=section_uuid,json=sectionUuid,proto3" json:"section_uuid,omitempty"`
	// contains filtered or unexported fields
}

SectionForType identifies a section to ignore for a specific document type.

func (*SectionForType) Descriptor deprecated added in v0.22.0

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

Deprecated: Use SectionForType.ProtoReflect.Descriptor instead.

func (*SectionForType) GetSectionUuid added in v0.22.0

func (x *SectionForType) GetSectionUuid() string

func (*SectionForType) GetType added in v0.22.0

func (x *SectionForType) GetType() string

func (*SectionForType) ProtoMessage added in v0.22.0

func (*SectionForType) ProtoMessage()

func (*SectionForType) ProtoReflect added in v0.22.0

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

func (*SectionForType) Reset added in v0.22.0

func (x *SectionForType) Reset()

func (*SectionForType) String added in v0.22.0

func (x *SectionForType) String() string

type SendDocumentRequest

type SendDocumentRequest struct {

	// The UUID of the document to replicate.
	Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	// Force replication even if the document has already been replicated.
	Force bool `protobuf:"varint,2,opt,name=force,proto3" json:"force,omitempty"`
	// contains filtered or unexported fields
}

func (*SendDocumentRequest) Descriptor deprecated

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

Deprecated: Use SendDocumentRequest.ProtoReflect.Descriptor instead.

func (*SendDocumentRequest) GetForce

func (x *SendDocumentRequest) GetForce() bool

func (*SendDocumentRequest) GetUuid

func (x *SendDocumentRequest) GetUuid() string

func (*SendDocumentRequest) ProtoMessage

func (*SendDocumentRequest) ProtoMessage()

func (*SendDocumentRequest) ProtoReflect

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

func (*SendDocumentRequest) Reset

func (x *SendDocumentRequest) Reset()

func (*SendDocumentRequest) String

func (x *SendDocumentRequest) String() string

type SendDocumentResponse

type SendDocumentResponse struct {

	// The version of the document that was replicated to the target.
	TargetVersion int64 `protobuf:"varint,1,opt,name=target_version,json=targetVersion,proto3" json:"target_version,omitempty"`
	// contains filtered or unexported fields
}

func (*SendDocumentResponse) Descriptor deprecated

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

Deprecated: Use SendDocumentResponse.ProtoReflect.Descriptor instead.

func (*SendDocumentResponse) GetTargetVersion

func (x *SendDocumentResponse) GetTargetVersion() int64

func (*SendDocumentResponse) ProtoMessage

func (*SendDocumentResponse) ProtoMessage()

func (*SendDocumentResponse) ProtoReflect

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

func (*SendDocumentResponse) Reset

func (x *SendDocumentResponse) Reset()

func (*SendDocumentResponse) String

func (x *SendDocumentResponse) String() string

type SyncConfig added in v0.22.0

type SyncConfig struct {

	// Accept and skip documents that fail to replicate instead of blocking.
	AcceptErrors bool `protobuf:"varint,1,opt,name=accept_errors,json=acceptErrors,proto3" json:"accept_errors,omitempty"`
	// Replicate all attachments for documents.
	AllAttachments bool `protobuf:"varint,2,opt,name=all_attachments,json=allAttachments,proto3" json:"all_attachments,omitempty"`
	// Document types to exclude from replication.
	IgnoreTypes []string `protobuf:"bytes,3,rep,name=ignore_types,json=ignoreTypes,proto3" json:"ignore_types,omitempty"`
	// Sections to exclude from replication, identified by document type and
	// section UUID.
	IgnoreSections []*SectionForType `protobuf:"bytes,4,rep,name=ignore_sections,json=ignoreSections,proto3" json:"ignore_sections,omitempty"`
	// Specific attachments to include when all_attachments is false.
	IncludeAttachments []*AttachmentForType `protobuf:"bytes,5,rep,name=include_attachments,json=includeAttachments,proto3" json:"include_attachments,omitempty"`
	// Ignore events generated by these client subs.
	IgnoreSubs []string `protobuf:"bytes,6,rep,name=ignore_subs,json=ignoreSubs,proto3" json:"ignore_subs,omitempty"`
	// contains filtered or unexported fields
}

SyncConfig controls what documents and content are replicated.

func (*SyncConfig) Descriptor deprecated added in v0.22.0

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

Deprecated: Use SyncConfig.ProtoReflect.Descriptor instead.

func (*SyncConfig) GetAcceptErrors added in v0.22.0

func (x *SyncConfig) GetAcceptErrors() bool

func (*SyncConfig) GetAllAttachments added in v0.22.0

func (x *SyncConfig) GetAllAttachments() bool

func (*SyncConfig) GetIgnoreSections added in v0.22.0

func (x *SyncConfig) GetIgnoreSections() []*SectionForType

func (*SyncConfig) GetIgnoreSubs added in v0.22.0

func (x *SyncConfig) GetIgnoreSubs() []string

func (*SyncConfig) GetIgnoreTypes added in v0.22.0

func (x *SyncConfig) GetIgnoreTypes() []string

func (*SyncConfig) GetIncludeAttachments added in v0.22.0

func (x *SyncConfig) GetIncludeAttachments() []*AttachmentForType

func (*SyncConfig) ProtoMessage added in v0.22.0

func (*SyncConfig) ProtoMessage()

func (*SyncConfig) ProtoReflect added in v0.22.0

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

func (*SyncConfig) Reset added in v0.22.0

func (x *SyncConfig) Reset()

func (*SyncConfig) String added in v0.22.0

func (x *SyncConfig) String() string

type TargetAction added in v0.22.0

type TargetAction int32

TargetAction is the action to take on a replication target.

const (
	TargetAction_TARGET_ACTION_UNSPECIFIED TargetAction = 0
	TargetAction_TARGET_ACTION_START       TargetAction = 1
	TargetAction_TARGET_ACTION_STOP        TargetAction = 2
)

func (TargetAction) Descriptor added in v0.22.0

func (TargetAction) Enum added in v0.22.0

func (x TargetAction) Enum() *TargetAction

func (TargetAction) EnumDescriptor deprecated added in v0.22.0

func (TargetAction) EnumDescriptor() ([]byte, []int)

Deprecated: Use TargetAction.Descriptor instead.

func (TargetAction) Number added in v0.22.0

func (TargetAction) String added in v0.22.0

func (x TargetAction) String() string

func (TargetAction) Type added in v0.22.0

type TargetState added in v0.22.0

type TargetState int32

TargetState describes the current runtime state of a replication target.

const (
	TargetState_TARGET_STATE_UNSPECIFIED TargetState = 0
	TargetState_TARGET_STATE_RUNNING     TargetState = 1
	TargetState_TARGET_STATE_STARTING    TargetState = 2
	TargetState_TARGET_STATE_STOPPING    TargetState = 3
	TargetState_TARGET_STATE_STOPPED     TargetState = 4
)

func (TargetState) Descriptor added in v0.22.0

func (TargetState) Enum added in v0.22.0

func (x TargetState) Enum() *TargetState

func (TargetState) EnumDescriptor deprecated added in v0.22.0

func (TargetState) EnumDescriptor() ([]byte, []int)

Deprecated: Use TargetState.Descriptor instead.

func (TargetState) Number added in v0.22.0

func (x TargetState) Number() protoreflect.EnumNumber

func (TargetState) String added in v0.22.0

func (x TargetState) String() string

func (TargetState) Type added in v0.22.0

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 NewReplicationServer

func NewReplicationServer(svc Replication, opts ...interface{}) TwirpServer

NewReplicationServer 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