Documentation
¶
Index ¶
- Variables
- type ABFSUpdater
- type AddMapRequest
- func (r *AddMapRequest) Execute(ctx context.Context, updater ABFSUpdater, accessor ObjectAccessor) error
- func (r *AddMapRequest) Key() entities.Hash
- func (r *AddMapRequest) Links(accessor ObjectAccessor) ([]entities.Hash, error)
- func (r *AddMapRequest) String() string
- func (r *AddMapRequest) Type() string
- type Callback
- type DAGSync
- func (d *DAGSync) AddMapResult(from, to entities.Hash) fmt.Stringer
- func (d *DAGSync) Dump(ctx context.Context, w io.Writer)
- func (d *DAGSync) Phony(priority RequestPriority, objects []entities.Hash, callback Callback) fmt.Stringer
- func (d *DAGSync) PutBlob(key entities.Hash) fmt.Stringer
- func (d *DAGSync) PutObject(key entities.Hash) fmt.Stringer
- func (d *DAGSync) PutRefs(server string, project string, refs []entities.RefHash, callbacks ...Callback) fmt.Stringer
- func (d *DAGSync) PutTree(key entities.Hash) fmt.Stringer
- func (d *DAGSync) Send(m Message)
- func (d *DAGSync) Start(ctx context.Context)
- func (d *DAGSync) State(tag string) (NodeState, bool)
- func (d *DAGSync) Stats() Stats
- func (d *DAGSync) UpdateLogger(logger *log.Logger)
- func (d *DAGSync) Validate(ctx context.Context, w io.Writer, nodeStaleTimeout time.Duration)
- func (d *DAGSync) Wait(timeoutDuration time.Duration) error
- type DagSyncOpts
- type Mailbox
- type Message
- type NodeState
- type ObjectAccessor
- type PhonyRequest
- type PriorityQueue
- type PutObjectRequest
- func (r *PutObjectRequest) Execute(ctx context.Context, updater ABFSUpdater, accessor ObjectAccessor) error
- func (r *PutObjectRequest) IsBlob() bool
- func (r *PutObjectRequest) Key() entities.Hash
- func (r *PutObjectRequest) Links(accessor ObjectAccessor) ([]entities.Hash, error)
- func (r *PutObjectRequest) String() string
- func (r *PutObjectRequest) Type() string
- type PutRefsRequest
- func (r *PutRefsRequest) Execute(ctx context.Context, updater ABFSUpdater, accessor ObjectAccessor) error
- func (r *PutRefsRequest) Key() entities.Hash
- func (r *PutRefsRequest) Links(accessor ObjectAccessor) ([]entities.Hash, error)
- func (r *PutRefsRequest) String() string
- func (r *PutRefsRequest) Type() string
- type QueuePriority
- type ReadSizeCloser
- type Request
- type RequestPriority
- type SizeProvider
- type Stats
Constants ¶
This section is empty.
Variables ¶
View Source
var Debug = false
Functions ¶
This section is empty.
Types ¶
type ABFSUpdater ¶
type ABFSUpdater interface {
Headers(ctx context.Context, keys []remote.Hash) ([]entities.ObjectHeader, error)
PutObject(ctx context.Context, key entities.Hash, reader remote.ContentReadCloser) error
AddMapResult(ctx context.Context, from, to entities.Hash) error
PutRefs(ctx context.Context, server string, project string, refs []entities.RefHash) error
}
type AddMapRequest ¶
type AddMapRequest struct {
// contains filtered or unexported fields
}
func (*AddMapRequest) Execute ¶
func (r *AddMapRequest) Execute(ctx context.Context, updater ABFSUpdater, accessor ObjectAccessor) error
func (*AddMapRequest) Key ¶
func (r *AddMapRequest) Key() entities.Hash
func (*AddMapRequest) Links ¶
func (r *AddMapRequest) Links(accessor ObjectAccessor) ([]entities.Hash, error)
func (*AddMapRequest) String ¶
func (r *AddMapRequest) String() string
func (*AddMapRequest) Type ¶
func (r *AddMapRequest) Type() string
type DAGSync ¶
type DAGSync struct {
MaintenanceRunInterval time.Duration
FailCooldown time.Duration
PlaceholderNodeTimeout time.Duration
MailboxDelay time.Duration
// contains filtered or unexported fields
}
func New ¶
func New(opts *DagSyncOpts) *DAGSync
func (*DAGSync) Dump ¶
Dump writes the information of all nodes to the given writer (used for debugging purposes). It locks the global lock so it should not be used lightly.
func (*DAGSync) UpdateLogger ¶
type DagSyncOpts ¶
type DagSyncOpts struct {
Updater ABFSUpdater
Accessor ObjectAccessor
WorkersCount int
PeekOffline func(entities.Hash) (bool, bool)
OnPush func(entities.Hash, string)
// If = 0, skipping is disabled.
// If enabled, the ObjectAccessor must also be a SizeProvider.
OfflineThreshold uint64
Logger *log.Logger
}
type Mailbox ¶
type Mailbox struct {
// contains filtered or unexported fields
}
Mailbox provides a similar interface to a channel, but with an unbound capacity.
func (*Mailbox) Close ¶
func (mb *Mailbox) Close()
Close gracefully shuts down the mailbox. Similar to golang channels, it signals there will be no more sends and Receive will be closed after all messages are consumed.
type NodeState ¶
type NodeState int
const ( HolderState NodeState = iota // The node is only a placeholder for the object InitialLinkBuildingState // The node is going through the initial link generation FailedLinkBuildState // The node has failed to build the links, it will be retried QueuedState // The node is ready to be executed and is added to the queue BlockedState // The node is blocked by one of its dependencies RunningState // The node is being executed FixingLinkValidationState // The node failed to execute due to a link validation error, and it is being fixed before re-activating FailedState // The execution of the node has failed, it will be retried )
type ObjectAccessor ¶
type ObjectAccessor interface {
GetObject(ctx context.Context, key entities.Hash) ([]byte, error)
// OpenBlob is required to return a ReadSizeCloser because the size is needed as a header
// to the object. If the size isn't provided, all the bytes must be read into memory, which
// is an issue for concurrent large blobs.
OpenBlob(ctx context.Context, key entities.Hash) (ReadSizeCloser, error)
}
type PhonyRequest ¶
type PhonyRequest struct {
// contains filtered or unexported fields
}
func (*PhonyRequest) Execute ¶
func (r *PhonyRequest) Execute(ctx context.Context, updater ABFSUpdater, accessor ObjectAccessor) error
func (*PhonyRequest) Key ¶
func (r *PhonyRequest) Key() entities.Hash
func (*PhonyRequest) Links ¶
func (r *PhonyRequest) Links(_ ObjectAccessor) ([]entities.Hash, error)
func (*PhonyRequest) String ¶
func (r *PhonyRequest) String() string
func (*PhonyRequest) Type ¶
func (r *PhonyRequest) Type() string
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue orders by greater priority value then earlier time.
func NewPriorityQueue ¶
func NewPriorityQueue() *PriorityQueue
func (*PriorityQueue) Len ¶
func (q *PriorityQueue) Len() int
Len returns the number of items safely.
func (*PriorityQueue) Peek ¶
func (q *PriorityQueue) Peek() *node
func (*PriorityQueue) Push ¶
func (q *PriorityQueue) Push(item *node)
func (*PriorityQueue) Remove ¶
func (q *PriorityQueue) Remove(n *node)
func (*PriorityQueue) Update ¶
func (p *PriorityQueue) Update(n *node, priority RequestPriority)
type PutObjectRequest ¶
type PutObjectRequest struct {
// contains filtered or unexported fields
}
func (*PutObjectRequest) Execute ¶
func (r *PutObjectRequest) Execute(ctx context.Context, updater ABFSUpdater, accessor ObjectAccessor) error
func (*PutObjectRequest) IsBlob ¶
func (r *PutObjectRequest) IsBlob() bool
func (*PutObjectRequest) Key ¶
func (r *PutObjectRequest) Key() entities.Hash
func (*PutObjectRequest) Links ¶
func (r *PutObjectRequest) Links(accessor ObjectAccessor) ([]entities.Hash, error)
func (*PutObjectRequest) String ¶
func (r *PutObjectRequest) String() string
func (*PutObjectRequest) Type ¶
func (r *PutObjectRequest) Type() string
type PutRefsRequest ¶
type PutRefsRequest struct {
// contains filtered or unexported fields
}
func (*PutRefsRequest) Execute ¶
func (r *PutRefsRequest) Execute(ctx context.Context, updater ABFSUpdater, accessor ObjectAccessor) error
func (*PutRefsRequest) Key ¶
func (r *PutRefsRequest) Key() entities.Hash
func (*PutRefsRequest) Links ¶
func (r *PutRefsRequest) Links(accessor ObjectAccessor) ([]entities.Hash, error)
func (*PutRefsRequest) String ¶
func (r *PutRefsRequest) String() string
func (*PutRefsRequest) Type ¶
func (r *PutRefsRequest) Type() string
type QueuePriority ¶
type QueuePriority struct {
// contains filtered or unexported fields
}
type ReadSizeCloser ¶
type ReadSizeCloser interface {
io.ReadCloser
entities.Sizer
}
type Request ¶
type Request interface {
Links(accessor ObjectAccessor) ([]entities.Hash, error)
Execute(ctx context.Context, updater ABFSUpdater, accessor ObjectAccessor) error
Type() string
String() string
Key() entities.Hash
}
func NewObjectRequest ¶
NewObjectRequest creates an Object request based on the provided type
type RequestPriority ¶
type RequestPriority float64
type SizeProvider ¶
Click to show internal directories.
Click to hide internal directories.