Documentation ¶
Overview ¶
Package artifactcontent can serve artifact content via plain HTTP securely.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RBEConn ¶
func RBEConn(ctx context.Context) (*grpc.ClientConn, error)
RBEConn creates a gRPC connection to RBE authenticated as self.
func RegisterRBEInstanceFlag ¶
RegisterRBEInstanceFlag registers -artifact-rbe-instance flag.
func ResourceName ¶
Types ¶
type HostnameProvider ¶
HostnameProvider returns a hostname to use in generated signed URLs.
As input it accepts `host` metadata value of the GetArtifacts etc. requests. It may be an empty string. HostnameProvider must return some host name in this case too.
type MetricsWriter ¶
type MetricsWriter struct {
// contains filtered or unexported fields
}
MetricsWriter can be used to record artifact transfer metrics, by creating one out of the router context before the transfer, and calling its .Download or .Upload methods afterwards.
func NewMetricsWriter ¶
func NewMetricsWriter(c *router.Context) *MetricsWriter
NewMetricsWriter creates a MetricsWriter to be used after the transfer is complete to time the operation and write the metrics. It also replaces the given context's writer with a wrapped writer that keeps track of the response status.
type Reader ¶
type Reader struct { // RBEInstance is the name of the RBE instance where the artifact is stored. // Example: "projects/luci-resultdb/instances/artifacts". RBEInstance string // Hash is the hash of the artifact content stored in RBE-CAS. Hash string // Size is the content size in bytes. Size int64 }
Reader reads the artifact content from RBE-CAS.
func (*Reader) DownloadRBECASContent ¶
func (r *Reader) DownloadRBECASContent(ctx context.Context, bs bytestream.ByteStreamClient, f func(context.Context, io.Reader) error) error
DownloadRBECASContent calls f for the downloaded artifact content.
type Server ¶
type Server struct { // Use http:// (not https://) for generated URLs. InsecureURLs bool // Returns a hostname to use in generated signed URLs. HostnameProvider HostnameProvider // Reads a blob from RBE-CAS. ReadCASBlob func(ctx context.Context, req *bytestream.ReadRequest) (bytestream.ByteStream_ReadClient, error) // Full name of the RBE-CAS instance used to store artifacts, // e.g. "projects/luci-resultdb/instances/artifacts". RBECASInstanceName string }
Server can serve artifact content, and generate signed URLs to the content.
func (*Server) GenerateSignedURL ¶
func (s *Server) GenerateSignedURL(ctx context.Context, requestHost, artifactName string) (url string, expiration time.Time, err error)
GenerateSignedURL generates a signed HTTPS URL back to this server. The returned token works only with the same artifact name.
func (*Server) InstallHandlers ¶
InstallHandlers installs handlers to serve artifact content.
May be called multiple times to install the handler into multiple virtual hosts.