summaryrefslogtreecommitdiff
path: root/internal/clients/connectors/connector.go
blob: c1211ec9d0e7ec79774f250f41a8718a5d37765d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package connectors

import (
	"context"
	"time"

	"github.com/mimecast/dtail/internal/clients/handlers"
	sessionspec "github.com/mimecast/dtail/internal/session"
)

// Connector interface.
type Connector interface {
	// Start the connection.
	Start(ctx context.Context, cancel context.CancelFunc, throttleCh, statsCh chan struct{})
	// Server hostname.
	Server() string
	// Handler for the connection.
	Handler() handlers.Handler
	// SupportsQueryUpdates reports whether the connected server advertised
	// runtime query replacement support within the given timeout.
	SupportsQueryUpdates(timeout time.Duration) bool
	// ApplySessionSpec starts or updates the interactive session workload on an
	// already connected server when query updates are supported.
	ApplySessionSpec(spec sessionspec.Spec, timeout time.Duration) error
	// CommittedSession returns the last session spec and generation that the
	// server acknowledged for this connection.
	CommittedSession() (sessionspec.Spec, uint64, bool)
}