tagreplication

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright (c) 2016-2019 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) 2016-2019 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) 2016-2019 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) 2016-2019 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) 2016-2019 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) 2016-2019 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

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor executes tag replication tasks.

func NewExecutor

func NewExecutor(
	stats tally.Scope,
	originCluster blobclient.ClusterClient,
	tagClientProvider tagclient.Provider) *Executor

NewExecutor creates a new Executor.

func (*Executor) Exec

func (e *Executor) Exec(r persistedretry.Task) error

Exec replicates a tag's blob dependencies to the task's remote origin cluster, then replicates the tag to the remote build-index.

func (*Executor) Name

func (e *Executor) Name() string

Name returns the executor name.

type Remote

type Remote struct {
	// contains filtered or unexported fields
}

Remote represents a remote build-index.

type RemoteValidator

type RemoteValidator interface {
	Valid(tag, addr string) bool
}

RemoteValidator validates remotes.

type Remotes

type Remotes []*Remote

Remotes represents all namespaces and their configured remote build-indexes.

func (Remotes) Match

func (rs Remotes) Match(tag string) (addrs []string)

Match returns all matched remotes for a tag.

func (Remotes) Valid

func (rs Remotes) Valid(tag, addr string) bool

Valid returns true if tag matches to addr.

type RemotesConfig

type RemotesConfig map[string][]string

RemotesConfig defines remote replication configuration which specifies which namespaces should be replicated to certain build-indexes.

For example, given the configuration:

build-index-zone1:
- namespace_foo/.*

build-index-zone2:
- namespace_foo/.*

Any builds matching the namespace_foo/.* namespace should be replicated to zone1 and zone2 build-indexes.

func (RemotesConfig) Build

func (c RemotesConfig) Build() (Remotes, error)

Build builds configuration into Remotes.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store stores tags to be replicated asynchronously.

func NewStore

func NewStore(db *sqlx.DB, rv RemoteValidator) (*Store, error)

NewStore creates a new Store.

func (*Store) AddFailed

func (s *Store) AddFailed(r persistedretry.Task) error

AddFailed adds r as failed.

func (*Store) AddPending

func (s *Store) AddPending(r persistedretry.Task) error

AddPending adds r as pending.

func (*Store) Find

func (s *Store) Find(query interface{}) ([]persistedretry.Task, error)

Find is not supported.

func (*Store) GetFailed

func (s *Store) GetFailed() ([]persistedretry.Task, error)

GetFailed returns all failed tasks.

func (*Store) GetPending

func (s *Store) GetPending() ([]persistedretry.Task, error)

GetPending returns all pending tasks.

func (*Store) MarkFailed

func (s *Store) MarkFailed(r persistedretry.Task) error

MarkFailed marks r as failed.

func (*Store) MarkPending

func (s *Store) MarkPending(r persistedretry.Task) error

MarkPending marks r as pending.

func (*Store) Remove

func (s *Store) Remove(r persistedretry.Task) error

Remove removes r.

type Task

type Task struct {
	Tag          string          `db:"tag"`
	Digest       core.Digest     `db:"digest"`
	Dependencies core.DigestList `db:"dependencies"`
	Destination  string          `db:"destination"`
	CreatedAt    time.Time       `db:"created_at"`
	LastAttempt  time.Time       `db:"last_attempt"`
	Failures     int             `db:"failures"`
	Delay        time.Duration   `db:"delay"`
}

Task contains information to replicate a tag and its dependencies to a remote destination.

func NewTask

func NewTask(
	tag string,
	d core.Digest,
	dependencies core.DigestList,
	destination string,
	delay time.Duration) *Task

NewTask creates a new Task.

func TaskFixture

func TaskFixture() *Task

TaskFixture creates a fixture of tagreplication.Task.

func (*Task) GetFailures

func (t *Task) GetFailures() int

GetFailures returns the number of times t has failed.

func (*Task) GetLastAttempt

func (t *Task) GetLastAttempt() time.Time

GetLastAttempt returns when t was last attempted.

func (*Task) Ready

func (t *Task) Ready() bool

Ready returns whether t is ready to run.

func (*Task) String

func (t *Task) String() string

func (*Task) Tags added in v0.1.2

func (t *Task) Tags() map[string]string

Tags returns the replication destination.

type TaskMatcher

type TaskMatcher struct {
	// contains filtered or unexported fields
}

TaskMatcher is a gomock Matcher which matches two tasks.

func MatchTask

func MatchTask(task *Task) *TaskMatcher

MatchTask returns a new TaskMatcher

func (*TaskMatcher) Matches

func (m *TaskMatcher) Matches(x interface{}) bool

Matches compares two tasks. It ignores checking for time.

func (*TaskMatcher) String

func (m *TaskMatcher) String() string

String returns the name of the matcher.

Jump to

Keyboard shortcuts

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