Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register creates the channel a gRPC source reads its path from. It holds the path if nothing else does, and otherwise waits to take it over.
func Unregister ¶
Unregister releases a channel's claim on a path. Only the channel that holds the path removes it, so an outgoing engine's teardown cannot remove the source that took over from it.
Types ¶
type GenericProtoSource ¶
type GenericProtoSource struct {
ProtoFile string
MessageName string
Source hermod.Source
// contains filtered or unexported fields
}
GenericProtoSource wraps another source and decodes its payload using dynamic Protobuf descriptors.
func NewGenericProtoSource ¶
func NewGenericProtoSource(protoFile, messageName string, source hermod.Source) (*GenericProtoSource, error)
NewGenericProtoSource creates a new GenericProtoSource.
func (*GenericProtoSource) Close ¶
func (s *GenericProtoSource) Close() error
type GrpcSource ¶
type GrpcSource struct {
Path string
// contains filtered or unexported fields
}
GrpcSource implements the hermod.Source interface for receiving gRPC calls.
func NewGrpcSource ¶
func NewGrpcSource(path string) *GrpcSource
NewGrpcSource creates a new GrpcSource.
func (*GrpcSource) Close ¶
func (s *GrpcSource) Close() error
type Server ¶
type Server struct {
proto.UnimplementedSourceServiceServer
// Storage is the store holding the sources' API keys, for a caller whose
// store never changes.
Storage storage.Storage
// StorageFunc, when set, is asked for that store on every Publish and takes
// precedence over Storage. The API server needs this: its store is nil
// until first-time setup opens a database and is replaced again by a
// database switch, and a copy taken when the listener started never saw
// either — so a fresh install checked no keys at all until it was restarted.
StorageFunc func() storage.Storage
}
Server implements the proto.SourceServiceServer interface.
func (*Server) Publish ¶
func (s *Server) Publish(ctx context.Context, req *proto.PublishRequest) (*proto.PublishResponse, error)
func (*Server) PublishStream ¶ added in v1.17.0
func (s *Server) PublishStream(stream grpc.BidiStreamingServer[proto.PublishRequest, proto.PublishResponse]) error
PublishStream is Publish over one long-lived stream. Every record received is answered with one response under that record's id: "dispatched", or for a source that responds synchronously, what the workflow did with it.
A record that cannot be queued — nothing holds its path, or the source's buffer is full — is answered "rejected" and the stream stays open: neither is a reason to make a producer reconnect. A record its key does not cover ends the stream with the error, as it would end a call.