luci: go.chromium.org/luci/resultdb/sink Index | Files

package sink

import "go.chromium.org/luci/resultdb/sink"

Package sink provides a server for aggregating test results and sending them to the ResultDB backend.

Index

Package Files

sink.go

Constants

const (
    // DefaultPort is the TCP port that the Server listens on by default.
    DefaultPort = 62115
)

type Server Uses

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

Server contains state relevant to the server itself. It should always be created by a call to NewServer. After a call to Serve(), Server will accept connections on its Port and gather test results to send to its Recorder.

func NewServer Uses

func NewServer(ctx context.Context, cfg ServerConfig) (*Server, error)

NewServer creates a Server value and populates optional values with defaults.

func (*Server) Close Uses

func (s *Server) Close() error

Close immediately stops the server from accepting new connections and cancels existing ones.

func (*Server) Config Uses

func (s *Server) Config() ServerConfig

Config retrieves the ServerConfig of a previously created Server.

Use this to retrieve the resolved values of unset optional fields in the original ServerConfig.

func (*Server) ErrC Uses

func (s *Server) ErrC() <-chan error

ErrC returns a channel that transmits a server error.

Receiving an error on this channel implies that the server has either stopped running or is in the process of stopping.

func (*Server) Export Uses

func (s *Server) Export(ctx context.Context) context.Context

Export exports lucictx.ResultDB derived from the server configuration into the context.

func (*Server) Process Uses

func (s *Server) Process(msg *sinkpb.SinkMessageContainer) error

Process handles a message as if it had been sent over the TCP interface.

func (*Server) Run Uses

func (s *Server) Run(ctx context.Context, callback func(context.Context) error) error

Run invokes callback in a context where the server is running.

The context passed to callback will be cancelled if the server encounters an error. The context also has the server's information exported into it. If callback finishes running, Run will return the error it returned.

func (*Server) Start Uses

func (s *Server) Start(ctx context.Context) error

Start runs the server.

On success, Start will return nil, and a subsequent error will be sent on the server's ErrC channel.

type ServerConfig Uses

type ServerConfig struct {
    // Recorder is the gRPC client to the Recorder service exposed by ResultDB.
    Recorder *pb.RecorderClient

    // AuthToken is a secret token to expect from clients. If it is "" then it
    // will be randomly generated in a secure way.
    AuthToken string
    // Port is the TCP port to listen on. If 0, the server will use DefaultPort.
    Port int

    // Invocation is the name of the invocation that test results should append
    // to.
    Invocation string
    // UpdateToken is the token that allows writes to Invocation.
    UpdateToken string

    // TestIDPrefix will be prepended to the test_id of each TestResult.
    TestIDPrefix string
}

ServerConfig defines the parameters of the server.

Package sink imports 15 packages (graph) and is imported by 1 packages. Updated 2020-01-25. Refresh now. Tools for package owners.