common

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Copyright (c) 2017-2018 Uber Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2017-2018 Uber Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2017-2018 Uber Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNamespaceAlreadyExists indicates namespace already exists
	ErrNamespaceAlreadyExists = errors.New("Namespace already exists")
	// ErrInvalidJobConfig indicates job config is invalid
	ErrInvalidJobConfig = errors.New("Job config is invalid")
	// ErrIllegalJobConfigVersion indicates job config version is illegal
	ErrIllegalJobConfigVersion = errors.New("Job config version is illegal")
	// ErrJobConfigAlreadyExist indicates job config already exists
	ErrJobConfigAlreadyExist = errors.New("Job config already exists")
	// ErrIngestionAssignmentAlreadyExist indicates an ingestion assignment already exists
	ErrIngestionAssignmentAlreadyExist = errors.New("Ingestion assignment already exists")
	// ErrInstanceAlreadyExist indicates an instance already exists
	ErrInstanceAlreadyExist = errors.New("Instance already exists")

	// ErrJobConfigDoesNotExist indicates job config does not exist
	ErrJobConfigDoesNotExist = NotExist("Job config does not exist")
	// ErrIngestionAssignmentDoesNotExist indicats an assignment does not exist
	ErrIngestionAssignmentDoesNotExist = NotExist("Ingestion assignment does not exist")
	// ErrNamespaceDoesNotExist indicates namespace does not exist
	ErrNamespaceDoesNotExist = NotExist("Namespace does not exist")
	// ErrInstanceDoesNotExist indicates an instance does not exist
	ErrInstanceDoesNotExist = NotExist("Instance does not exist")
	// ErrSubscriberDoesNotExist indicates an subscriber does not exist
	ErrSubscriberDoesNotExist = NotExist("Subscriber does not exist")
)

Functions

func IsNonExist

func IsNonExist(err error) bool

IsNonExist check whether error is non exist error

func Validate

func Validate(newJobConfig, oldJobConfig *models.JobConfig) (err error)

Validate check job config should be valid

Types

type EnumMutator

type EnumMutator interface {
	EnumReader
	// ExtendEnumCases try to extend new enum cases to given column
	ExtendEnumCases(namespace, table, column string, enumCases []string) ([]int, error)
}

EnumMutator defines EnumMutator interface

type EnumReader

type EnumReader interface {
	// GetEnumCases get all enum cases for the given table column
	GetEnumCases(namespace, table, column string) ([]string, error)
}

EnumReader reads enum cases

type IngestionAssignmentMutator

type IngestionAssignmentMutator interface {
	GetIngestionAssignment(namespace, name string) (IngestionAssignment models.IngestionAssignment, err error)
	GetIngestionAssignments(namespace string) (IngestionAssignment []models.IngestionAssignment, err error)
	DeleteIngestionAssignment(namespace, name string) error
	UpdateIngestionAssignment(namespace string, IngestionAssignment models.IngestionAssignment) error
	AddIngestionAssignment(namespace string, IngestionAssignment models.IngestionAssignment) error
	GetHash(namespace, subscriber string) (string, error)
}

IngestionAssignmentMutator defines rw operations

type JobMutator

type JobMutator interface {
	GetJob(namespace, name string) (job models.JobConfig, err error)
	GetJobs(namespace string) (job []models.JobConfig, err error)
	DeleteJob(namespace, name string) error
	UpdateJob(namespace string, job models.JobConfig) error
	AddJob(namespace string, job models.JobConfig) error
	GetHash(namespace string) (string, error)
}

JobMutator defines rw operations

type MembershipMutator

type MembershipMutator interface {
	// Join registers an instance to a namespace
	Join(namespace string, instance models.Instance) error
	// GetInstance returns an instance
	GetInstance(namespace, instanceName string) (models.Instance, error)
	// GetInstances returns a list of instances in a namespace
	GetInstances(namespace string) ([]models.Instance, error)
	// Leave removes an instance
	Leave(namespace, instanceName string) error
	// GetHash returns hash of all instances
	GetHash(namespace string) (string, error)
}

MembershipMutator defines membership rw operations

type NamespaceMutator

type NamespaceMutator interface {
	CreateNamespace(namespace string) error
	ListNamespaces() ([]string, error)
}

NamespaceMutator mutates table metadata

type NotExist

type NotExist string

NotExist represents not exist error

func (NotExist) Error

func (e NotExist) Error() string

type SubscriberMutator

type SubscriberMutator interface {
	// GetSubscriber returns a subscriber
	GetSubscriber(namespace, subscriberName string) (models.Subscriber, error)
	// GetSubscribers returns a list of subscribers
	GetSubscribers(namespace string) ([]models.Subscriber, error)
	// GetHash returns hash of all subscribers
	GetHash(namespace string) (string, error)
}

SubscriberMutator defines rw operations only read ops needed for now, creating and removing subscriber should be done by each subscriber process

type TableSchemaMutator

type TableSchemaMutator interface {
	ListTables(namespace string) ([]string, error)
	GetTable(namespace, name string) (*common.Table, error)
	CreateTable(namespace string, table *common.Table, force bool) error
	DeleteTable(namespace, name string) error
	UpdateTable(namespace string, table common.Table, force bool) error
	GetHash(namespace string) (string, error)
}

TableSchemaMutator mutates table metadata

Jump to

Keyboard shortcuts

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