Help us shape the future of Go! Take the 2026 Go Developer Survey

executive

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultExecutiveURL is where the executive can be reached
	DefaultExecutiveURL = "ctlstore-executive.segment.local"
)

Variables

View Source
var (
	ErrCookieConflict      = errors.New("Cookie conflict")
	ErrWriterNotFound      = errors.New("Writer not found")
	ErrWriterAlreadyExists = errors.New("Writer already exists with different credentials")
	ErrCookieTooLong       = fmt.Errorf("Maximum cookie length is %d bytes", limits.LimitWriterCookieSize)
)
View Source
var ErrTableDoesNotExist = errors.New("table does not exist")

Functions

This section is empty.

Types

type ExecutiveEndpoint

type ExecutiveEndpoint struct {
	HealthChecker                  HealthChecker
	Exec                           ExecutiveInterface
	EnableDestructiveSchemaChanges bool
}

ExecutiveEndpoint is an HTTP 'wrapper' for ExecutiveInterface

func (*ExecutiveEndpoint) Close

func (ee *ExecutiveEndpoint) Close() error

func (*ExecutiveEndpoint) Handler

func (ee *ExecutiveEndpoint) Handler() http.Handler

type ExecutiveInterface

type ExecutiveInterface interface {
	CreateFamily(familyName string) error
	CreateTable(familyName string, tableName string, fieldNames []string, fieldTypes []schema.FieldType, keyFields []string) error
	CreateTables([]schema.Table) error
	AddFields(familyName string, tableName string, fieldNames []string, fieldTypes []schema.FieldType) error

	Mutate(writerName string, writerSecret string, familyName string, cookie []byte, checkCookie []byte, requests []ExecutiveMutationRequest) error
	GetWriterCookie(writerName string, writerSecret string) ([]byte, error)
	SetWriterCookie(writerName string, writerSecret string, cookie []byte) error
	RegisterWriter(writerName string, writerSecret string) error

	TableSchema(familyName string, tableName string) (*schema.Table, error)
	FamilySchemas(familyName string) ([]schema.Table, error)

	ReadRow(familyName string, tableName string, where map[string]interface{}) (map[string]interface{}, error)

	ReadTableSizeLimits() (limits.TableSizeLimits, error)
	UpdateTableSizeLimit(limit limits.TableSizeLimit) error
	DeleteTableSizeLimit(table schema.FamilyTable) error

	ReadWriterRateLimits() (limits.WriterRateLimits, error)
	UpdateWriterRateLimit(limit limits.WriterRateLimit) error
	DeleteWriterRateLimit(writerName string) error

	ClearTable(table schema.FamilyTable) error
	DropTable(table schema.FamilyTable) error
	ReadFamilyTableNames(familyName schema.FamilyName) ([]schema.FamilyTable, error)
}

type ExecutiveMutationRequest

type ExecutiveMutationRequest struct {
	TableName string
	Delete    bool
	Values    map[string]interface{}
}

type ExecutiveService

type ExecutiveService interface {
	Start(ctx context.Context, bind string) error
	io.Closer
}

func ExecutiveServiceFromConfig

func ExecutiveServiceFromConfig(config ExecutiveServiceConfig) (ExecutiveService, error)

type ExecutiveServiceConfig

type ExecutiveServiceConfig struct {
	CtlDBDSN                       string
	RequestTimeout                 time.Duration
	MaxTableSize                   int64
	WarnTableSize                  int64
	WriterLimitPeriod              time.Duration
	WriterLimit                    int64
	EnableDestructiveSchemaChanges bool
}

type HealthChecker

type HealthChecker interface {
	HealthCheck() error
}

type SQLDBClient

type SQLDBClient interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

SQLDBClient allows generalizing several database/sql types

type TestExecutiveService

type TestExecutiveService struct {
	Addr net.Addr
	// contains filtered or unexported fields
}

func NewTestExecutiveService

func NewTestExecutiveService(bindTo string) (*TestExecutiveService, error)

func (*TestExecutiveService) Close

func (s *TestExecutiveService) Close() error

func (*TestExecutiveService) ExecutiveInterface

func (s *TestExecutiveService) ExecutiveInterface() ExecutiveInterface

func (*TestExecutiveService) ServeHTTP

func (s *TestExecutiveService) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL