Documentation
¶
Index ¶
- type Bundle
- type BundleHandler
- func (h BundleHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h BundleHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h BundleHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h BundleHandler) GetFile(w http.ResponseWriter, r *http.Request)
- func (h BundleHandler) List(w http.ResponseWriter, r *http.Request)
- type BundleStatus
- type Client
- type Clock
- type ClusterBundleHandler
- func (c *ClusterBundleHandler) Create(w http.ResponseWriter, r *http.Request)
- func (c *ClusterBundleHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (c *ClusterBundleHandler) Download(w http.ResponseWriter, r *http.Request)
- func (c *ClusterBundleHandler) List(w http.ResponseWriter, r *http.Request)
- func (c *ClusterBundleHandler) Status(w http.ResponseWriter, r *http.Request)
- type Coordinator
- type DiagnosticsBundleAlreadyExists
- type DiagnosticsBundleNotFoundError
- type DiagnosticsBundleUnreadableError
- type DiagnosticsClient
- func (d DiagnosticsClient) CreateBundle(ctx context.Context, node string, ID string) (*Bundle, error)
- func (d DiagnosticsClient) Delete(ctx context.Context, node string, id string) error
- func (d DiagnosticsClient) GetFile(ctx context.Context, node string, ID string, path string) error
- func (d DiagnosticsClient) List(ctx context.Context, node string) ([]*Bundle, error)
- func (d DiagnosticsClient) Status(ctx context.Context, node string, ID string) (*Bundle, error)
- type ErrorResponse
- type ParallelCoordinator
- type Status
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct { ID string `json:"id,omitempty"` Type Type `json:"type"` Size int64 `json:"size,omitempty"` // length in bytes for regular files; 0 when Canceled or Deleted Status Status `json:"status"` Started time.Time `json:"started_at,omitempty"` Stopped time.Time `json:"stopped_at,omitempty"` Errors []string `json:"errors,omitempty"` }
func (*Bundle) IsFinished ¶
type BundleHandler ¶
type BundleHandler struct {
// contains filtered or unexported fields
}
BundleHandler is a struct that collects all functions responsible for diagnostics bundle lifecycle
func NewBundleHandler ¶
func (BundleHandler) Create ¶
func (h BundleHandler) Create(w http.ResponseWriter, r *http.Request)
func (BundleHandler) Delete ¶
func (h BundleHandler) Delete(w http.ResponseWriter, r *http.Request)
func (BundleHandler) Get ¶
func (h BundleHandler) Get(w http.ResponseWriter, r *http.Request)
func (BundleHandler) GetFile ¶
func (h BundleHandler) GetFile(w http.ResponseWriter, r *http.Request)
func (BundleHandler) List ¶
func (h BundleHandler) List(w http.ResponseWriter, r *http.Request)
type BundleStatus ¶
type BundleStatus struct {
// contains filtered or unexported fields
}
BundleStatus tracks the status of local bundle creation requests
type Client ¶
type Client interface { // CreateBundle requests the given node to start a bundle creation process with that is identified by the given ID CreateBundle(ctx context.Context, node string, ID string) (*Bundle, error) // Status returns the status of the bundle with the given ID on the given node Status(ctx context.Context, node string, ID string) (*Bundle, error) // GetFile downloads the bundle file of the bundle with the given ID from the node // url and save it to local filesystem under given path. // Returns an error if there were a problem. GetFile(ctx context.Context, node string, ID string, path string) (err error) // List will get the list of available bundles on the given node List(ctx context.Context, node string) ([]*Bundle, error) // Delete will delete the bundle with the given id from the given node Delete(ctx context.Context, node string, ID string) error }
Client is an interface that can talk with dcos-diagnostics REST API and manipulate remote bundles
type ClusterBundleHandler ¶
type ClusterBundleHandler struct {
// contains filtered or unexported fields
}
ClusterBundleHandler is a handler that will create and manage cluster-wide diagnostics bundles
func NewClusterBundleHandler ¶
func NewClusterBundleHandler(c Coordinator, client Client, tools dcos.Tooler, workDir string, timeout time.Duration, urlBuilder dcos.NodeURLBuilder) (*ClusterBundleHandler, error)
func (*ClusterBundleHandler) Create ¶
func (c *ClusterBundleHandler) Create(w http.ResponseWriter, r *http.Request)
Create will send the initial creation request for the bundle to all nodes. The created bundle will exist on the called master node
func (*ClusterBundleHandler) Delete ¶
func (c *ClusterBundleHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete will delete a given bundle, proxying the call if the given bundle exists on a different master
func (*ClusterBundleHandler) Download ¶
func (c *ClusterBundleHandler) Download(w http.ResponseWriter, r *http.Request)
Download will download the given bundle, proxying the call to the appropriate master
func (*ClusterBundleHandler) List ¶
func (c *ClusterBundleHandler) List(w http.ResponseWriter, r *http.Request)
List will get a list of all bundles available across all masters
func (*ClusterBundleHandler) Status ¶
func (c *ClusterBundleHandler) Status(w http.ResponseWriter, r *http.Request)
Status will return the status of a given bundle, proxying the call to the appropriate master
type Coordinator ¶
type Coordinator interface { // CreateBundle starts the bundle creation process. Status updates be monitored // on the returned channel. CreateBundle(ctx context.Context, id string, nodes []node) <-chan BundleStatus // CollectBundle waits until all the nodes' bundles have finished, downloads, // and merges them. The resulting bundle zip file path is returned. CollectBundle(ctx context.Context, bundleID string, numBundles int, statuses <-chan BundleStatus) (string, error) }
golangcli-lint marks this as dead code because nothing uses the interface yet. this will be removed with the bundle handler PR coordinator is an interface to coordinate the creation of diagnostics bundles across a cluster of nodes
type DiagnosticsBundleAlreadyExists ¶
type DiagnosticsBundleAlreadyExists struct {
// contains filtered or unexported fields
}
func (*DiagnosticsBundleAlreadyExists) Error ¶
func (d *DiagnosticsBundleAlreadyExists) Error() string
type DiagnosticsBundleNotFoundError ¶
type DiagnosticsBundleNotFoundError struct {
// contains filtered or unexported fields
}
func (*DiagnosticsBundleNotFoundError) Error ¶
func (d *DiagnosticsBundleNotFoundError) Error() string
type DiagnosticsBundleUnreadableError ¶
type DiagnosticsBundleUnreadableError struct {
// contains filtered or unexported fields
}
func (*DiagnosticsBundleUnreadableError) Error ¶
func (d *DiagnosticsBundleUnreadableError) Error() string
type DiagnosticsClient ¶
type DiagnosticsClient struct {
// contains filtered or unexported fields
}
func NewDiagnosticsClient ¶
func NewDiagnosticsClient(client *http.Client) DiagnosticsClient
NewDiagnosticsClient constructs a diagnostics client
func (DiagnosticsClient) CreateBundle ¶
type ErrorResponse ¶
type ParallelCoordinator ¶
type ParallelCoordinator struct {
// contains filtered or unexported fields
}
ParallelCoordinator implements Coordinator interface to coordinate bundle creation across a cluster, parallelized across multiple goroutines.
func NewParallelCoordinator ¶
func NewParallelCoordinator(client Client, interval time.Duration, workDir string) *ParallelCoordinator
NewParallelCoordinator creates and returns a new ParallelCoordinator
func (ParallelCoordinator) CollectBundle ¶
func (c ParallelCoordinator) CollectBundle(ctx context.Context, bundleID string, numBundles int, statuses <-chan BundleStatus) (string, error)
CollectBundle waits until all the nodes' bundles have finished, downloads, and merges them. The resulting bundle zip file path is returned.
func (ParallelCoordinator) CreateBundle ¶
func (c ParallelCoordinator) CreateBundle(ctx context.Context, id string, nodes []node) <-chan BundleStatus
CreateBundle starts the bundle creation process. Status updates be monitored on the returned channel.
type Status ¶
type Status int
Status represents an bundle status
const ( Unknown Status = iota // No information about this bundle Started // Diagnostics is preparing InProgress // Diagnostics in progress Done // Diagnostics finished and the file is ready to be downloaded Canceled // Diagnostics has been cancelled Deleted // Diagnostics was finished but was deleted Failed // Diagnostics could not be downloaded )
func (Status) MarshalJSON ¶
MarshalJSON marshals the enum as a quoted json string
func (*Status) UnmarshalJSON ¶
UnmarshalJSON unmashals a quoted json string to the enum value
type Type ¶
type Type int
Type represents a bundle type
func (Type) MarshalJSON ¶
MarshalJSON marshals the enum as a quoted json string
func (*Type) UnmarshalJSON ¶
UnmarshalJSON unmashals a quoted json string to the enum value