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 ¶
- type Executor
- type FileStore
- type NameQuery
- type Store
- func (s *Store) AddFailed(r persistedretry.Task) error
- func (s *Store) AddPending(r persistedretry.Task) error
- func (s *Store) Find(query interface{}) ([]persistedretry.Task, error)
- func (s *Store) GetFailed() ([]persistedretry.Task, error)
- func (s *Store) GetPending() ([]persistedretry.Task, error)
- func (s *Store) MarkFailed(r persistedretry.Task) error
- func (s *Store) MarkPending(r persistedretry.Task) error
- func (s *Store) Remove(r persistedretry.Task) error
- type Task
- type TaskMatcher
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 write back tasks.
func NewExecutor ¶
NewExecutor creates a new Executor.
type FileStore ¶
type FileStore interface {
DeleteCacheFileMetadata(name string, md metadata.Metadata) error
GetCacheFileReader(name string) (store.FileReader, error)
}
FileStore defines store operations required for write-back.
type NameQuery ¶
type NameQuery struct {
// contains filtered or unexported fields
}
NameQuery queries writeback tasks which match a name.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store stores writeback tasks.
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 finds tasks matching query.
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.
type Task ¶
type Task struct {
Namespace string `db:"namespace"`
Name string `db:"name"`
CreatedAt time.Time `db:"created_at"`
LastAttempt time.Time `db:"last_attempt"`
Failures int `db:"failures"`
Delay time.Duration `db:"delay"`
// Trace context for linking async execution back to original request.
TraceID string `db:"trace_id"`
SpanID string `db:"span_id"`
TraceFlags string `db:"trace_flags"` // Hex string of trace flags (e.g., "01" if sampled)
// Deprecated. Use name instead.
Digest core.Digest `db:"digest"`
}
Task contains information to write back a blob to remote storage.
func NewTask ¶
NewTask creates a new Task. Deprecated: Use NewTaskWithContext to preserve trace context.
func NewTaskWithContext ¶ added in v0.1.20
NewTaskWithContext creates a new Task and captures the trace context from ctx. This allows the async writeback execution to be linked to the original request trace. It also captures TraceFlags to preserve the sampling decision.
func TaskFixture ¶
func TaskFixture() *Task
TaskFixture returns a randomly generated Task for testing purposes.
func (*Task) GetFailures ¶
GetFailures returns the number of times t has failed.
func (*Task) GetLastAttempt ¶
GetLastAttempt returns when t was last attempted.
func (*Task) HasTraceContext ¶ added in v0.1.20
HasTraceContext returns true if the task has captured trace context.
func (*Task) SpanContext ¶ added in v0.1.20
func (t *Task) SpanContext() trace.SpanContext
SpanContext reconstructs a trace.SpanContext from the stored trace IDs. Returns an invalid SpanContext if the task has no trace context or if parsing fails.
type TaskMatcher ¶
type TaskMatcher struct {
// contains filtered or unexported fields
}
TaskMatcher is a gomock Matcher which matches two tasks.
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.