Documentation
¶
Index ¶
- func MiddlewareConfigAvailable() bool
- func NewDeploymentManager(storages CASPair, logger *slog.Logger) *deploymentManager
- func NewMiddleware(origin http.Handler, manifestHandler *ManifestHandler, logger *slog.Logger) *turbochargerMiddleware
- func WrapWithMiddlewareIfConfigAvailable(ctx context.Context, inner http.Handler, logger *slog.Logger) (http.Handler, error)
- type CAS
- type CASPair
- type FileToDeploy
- type Manifest
- type ManifestHandler
- type ManifestMetadata
- type ManifestWithID
- type ObjectID
- type Path
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MiddlewareConfigAvailable ¶
func MiddlewareConfigAvailable() bool
func NewDeploymentManager ¶
func NewMiddleware ¶
func NewMiddleware(origin http.Handler, manifestHandler *ManifestHandler, logger *slog.Logger) *turbochargerMiddleware
func WrapWithMiddlewareIfConfigAvailable ¶
func WrapWithMiddlewareIfConfigAvailable(ctx context.Context, inner http.Handler, logger *slog.Logger) (http.Handler, error)
doesn't error if middleware configuration not available. errors if middleware configuration is available but has error, or if errors initializing.
Types ¶
type CAS ¶
type CAS interface {
GetObject(ctx context.Context, id ObjectID) (io.ReadCloser, error)
InsertObject(ctx context.Context, id ObjectID, content io.Reader, contentType string) error
}
represents S3, a filesystem or similar
type CASPair ¶
while you could use just one CAS to store both Files and Manifests, we suggest having separate stores for both so it's easier to enumerate deployments (= different manifest files) for cleanup purposes.
suppose your AWS S3 bills are at pain limit and you'd like to delete no-longer-in-use files from the CAS. you could do this by enumerating deployments, grouping them by project and assessing by deployment timestamp which manifests to delete. then you'd clean up all files no longer referenced by any remaining manifests.
we don't implement said pruning right now, but our architecture is prepared to patch that in later.
type FileToDeploy ¶
type Manifest ¶
type Manifest struct {
Metadata ManifestMetadata `json:"metadata"`
Files []Path `json:"files"` // "foobar/index.html" => 9f86d081884c7d65...
}
type ManifestHandler ¶
type ManifestHandler struct {
// contains filtered or unexported fields
}
func GetManifestHandlerSingleton ¶
func GetManifestHandlerSingleton(ctx context.Context, logger *slog.Logger) (*ManifestHandler, error)
you'll likely want to use a global instance since manifests are designed to be reloaded rapidly so there is no point in coupling the lifetime to a single manifest.
func (*ManifestHandler) ServeHTTPFromManifest ¶
func (h *ManifestHandler) ServeHTTPFromManifest(manifestID ObjectID, w http.ResponseWriter, r *http.Request) error
type ManifestMetadata ¶
type ManifestMetadata struct {
Project string `json:"project"`
Deployed time.Time `json:"deployed"`
}
additional metadata not used by turbocharger itself, but can be later used to implement pruning
func NewMetadata ¶
func NewMetadata(project string) ManifestMetadata
type ManifestWithID ¶
purely computed thing based on Manifest content
type ObjectID ¶
func ObjectIDFromString ¶
func (*ObjectID) ETagGZipped ¶
ETag is supposed to be different if it has Content-Encoding applied
func (*ObjectID) ETagUncompressed ¶
func (*ObjectID) MarshalJSON ¶
func (*ObjectID) UnmarshalJSON ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Code required to bring turbocharger support to concrete applications
|
Code required to bring turbocharger support to concrete applications |
