Documentation ¶
Overview ¶
Package lenses provides interfaces and methods necessary for implementing custom artifact viewers
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrGzipOffsetRead will be thrown when an offset read is attempted on a gzip-compressed object ErrGzipOffsetRead = errors.New("offset read on gzipped files unsupported") // ErrInvalidLensName will be thrown when a viewer method is called on a view name that has not // been registered. Ensure your viewer is registered using RegisterViewer and that you are // providing the correct viewer name. ErrInvalidLensName = errors.New("invalid lens name") // ErrFileTooLarge will be thrown when a size-limited operation (ex. ReadAll) is called on an // artifact whose size exceeds the configured limit. ErrFileTooLarge = errors.New("file size over specified limit") // ErrRequestSizeTooLarge will be thrown when any operation is called whose size exceeds the configured limit. ErrRequestSizeTooLarge = errors.New("request size over specified limit") // ErrContextUnsupported is thrown when attempting to use a context with an artifact that // does not support context operations (cancel, withtimeout, etc.) ErrContextUnsupported = errors.New("artifact does not support context operations") )
Functions ¶
func LastNLines ¶
LastNLines reads the last n lines from an artifact.
func LastNLinesChunked ¶
LastNLinesChunked reads the last n lines from an artifact by reading chunks of size chunkSize from the end of the artifact. Best performance is achieved by: argmin 0<chunkSize<INTMAX, f(chunkSize) = chunkSize - n * avgLineLength
func ResourceDirForLens ¶
ResourceDirForLens returns the path to a lens's public resource directory.
Types ¶
type Lens ¶
type Lens interface { // Config returns a LensConfig that describes the lens. Config() LensConfig // Header returns a a string that is injected into the rendered lens's <head> Header(artifacts []api.Artifact, resourceDir string, config json.RawMessage, spyglassConfig config.Spyglass) string // Body returns a string that is initially injected into the rendered lens's <body>. // The lens's front-end code may call back to Body again, passing in some data string of its choosing. Body(artifacts []api.Artifact, resourceDir string, data string, config json.RawMessage, spyglassConfig config.Spyglass) string // Callback receives a string sent by the lens's front-end code and returns another string to be returned // to that frontend code. Callback(artifacts []api.Artifact, resourceDir string, data string, config json.RawMessage, spyglassConfig config.Spyglass) string }
Lens defines the interface that lenses are required to implement in order to be used by Spyglass.
type LensConfig ¶
type LensConfig struct { // Name is the name of the lens. It must match the package name. Name string // Title is a human-readable title for the lens. Title string // Priority is used to determine where to position the lens. Higher is better. Priority uint // HideTitle will hide the lens title after loading if set to true. HideTitle bool }
Directories ¶
Path | Synopsis |
---|---|
Package buildlog provides a build log viewer for Spyglass
|
Package buildlog provides a build log viewer for Spyglass |
Package coverage provides a coverage viewer for Spyglass
|
Package coverage provides a coverage viewer for Spyglass |
Package junit provides a junit viewer for Spyglass
|
Package junit provides a junit viewer for Spyglass |
Package metadata provides a metadata viewer for Spyglass
|
Package metadata provides a metadata viewer for Spyglass |
Package podinfo provides a coverage viewer for Spyglass
|
Package podinfo provides a coverage viewer for Spyglass |
Click to show internal directories.
Click to hide internal directories.