Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
d21bd495
Unverified
Commit
d21bd495
authored
Oct 29, 2020
by
Nemanja Zbiljić
Committed by
GitHub
Oct 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document 'pullsync' package (#871)
parent
4742eb73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
doc.go
pkg/pullsync/doc.go
+14
-0
pullsync.go
pkg/pullsync/pullsync.go
+8
-0
No files found.
pkg/pullsync/doc.go
View file @
d21bd495
...
...
@@ -2,4 +2,18 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package pullsync contains protocol that is used to ensure that there is correct
chunk replication in the neighborhood of the node.
The protocol is used to exchange information about what chunks are stored on
other nodes and if necessary pull any chunks it needs. It also takes care that
chunks are not synced twice.
The pullsync protocol uses Protobuf messages for encoding. It then exposes
several functions which use those messages to start the exchange of other node
cursors using `GetCursors` function, after which node can schedule syncing
of chunks using `SyncInterval` function, and in the case of any errors or
timed-out operations cancel syncing using `CancelRuid`.
*/
package
pullsync
pkg/pullsync/pullsync.go
View file @
d21bd495
...
...
@@ -42,9 +42,17 @@ var (
// how many maximum chunks in a batch
var
maxPage
=
50
// Interface is the PullSync interface.
type
Interface
interface
{
// SyncInterval syncs a requested interval from the given peer.
// It returns the BinID of highest chunk that was synced from the given
// interval. If the requested interval is too large, the downstream peer
// has the liberty to provide less chunks than requested.
SyncInterval
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
bin
uint8
,
from
,
to
uint64
)
(
topmost
uint64
,
ruid
uint32
,
err
error
)
// GetCursors retrieves all cursors from a downstream peer.
GetCursors
(
ctx
context
.
Context
,
peer
swarm
.
Address
)
([]
uint64
,
error
)
// CancelRuid cancels active pullsync operation identified by ruid on
// a downstream peer.
CancelRuid
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
ruid
uint32
)
error
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment