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
e207becb
Unverified
Commit
e207becb
authored
Oct 23, 2020
by
acud
Committed by
GitHub
Oct 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pipeline: adjust signature to take in Putter instead of Storer (#861)
parent
5c657db7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
builder.go
pkg/file/pipeline/builder/builder.go
+5
-5
store.go
pkg/file/pipeline/store/store.go
+1
-1
No files found.
pkg/file/pipeline/builder/builder.go
View file @
e207becb
...
@@ -21,7 +21,7 @@ import (
...
@@ -21,7 +21,7 @@ import (
)
)
// NewPipelineBuilder returns the appropriate pipeline according to the specified parameters
// NewPipelineBuilder returns the appropriate pipeline according to the specified parameters
func
NewPipelineBuilder
(
ctx
context
.
Context
,
s
storage
.
Stor
er
,
mode
storage
.
ModePut
,
encrypt
bool
)
pipeline
.
Interface
{
func
NewPipelineBuilder
(
ctx
context
.
Context
,
s
storage
.
Putt
er
,
mode
storage
.
ModePut
,
encrypt
bool
)
pipeline
.
Interface
{
if
encrypt
{
if
encrypt
{
return
newEncryptionPipeline
(
ctx
,
s
,
mode
)
return
newEncryptionPipeline
(
ctx
,
s
,
mode
)
}
}
...
@@ -31,7 +31,7 @@ func NewPipelineBuilder(ctx context.Context, s storage.Storer, mode storage.Mode
...
@@ -31,7 +31,7 @@ func NewPipelineBuilder(ctx context.Context, s storage.Storer, mode storage.Mode
// newPipeline creates a standard pipeline that only hashes content with BMT to create
// newPipeline creates a standard pipeline that only hashes content with BMT to create
// a merkle-tree of hashes that represent the given arbitrary size byte stream. Partial
// a merkle-tree of hashes that represent the given arbitrary size byte stream. Partial
// writes are supported. The pipeline flow is: Data -> Feeder -> BMT -> Storage -> HashTrie.
// writes are supported. The pipeline flow is: Data -> Feeder -> BMT -> Storage -> HashTrie.
func
newPipeline
(
ctx
context
.
Context
,
s
storage
.
Stor
er
,
mode
storage
.
ModePut
)
pipeline
.
Interface
{
func
newPipeline
(
ctx
context
.
Context
,
s
storage
.
Putt
er
,
mode
storage
.
ModePut
)
pipeline
.
Interface
{
tw
:=
hashtrie
.
NewHashTrieWriter
(
swarm
.
ChunkSize
,
swarm
.
Branches
,
swarm
.
HashSize
,
newShortPipelineFunc
(
ctx
,
s
,
mode
))
tw
:=
hashtrie
.
NewHashTrieWriter
(
swarm
.
ChunkSize
,
swarm
.
Branches
,
swarm
.
HashSize
,
newShortPipelineFunc
(
ctx
,
s
,
mode
))
lsw
:=
store
.
NewStoreWriter
(
ctx
,
s
,
mode
,
tw
)
lsw
:=
store
.
NewStoreWriter
(
ctx
,
s
,
mode
,
tw
)
b
:=
bmt
.
NewBmtWriter
(
lsw
)
b
:=
bmt
.
NewBmtWriter
(
lsw
)
...
@@ -40,7 +40,7 @@ func newPipeline(ctx context.Context, s storage.Storer, mode storage.ModePut) pi
...
@@ -40,7 +40,7 @@ func newPipeline(ctx context.Context, s storage.Storer, mode storage.ModePut) pi
// newShortPipelineFunc returns a constructor function for an ephemeral hashing pipeline
// newShortPipelineFunc returns a constructor function for an ephemeral hashing pipeline
// needed by the hashTrieWriter.
// needed by the hashTrieWriter.
func
newShortPipelineFunc
(
ctx
context
.
Context
,
s
storage
.
Stor
er
,
mode
storage
.
ModePut
)
func
()
pipeline
.
ChainWriter
{
func
newShortPipelineFunc
(
ctx
context
.
Context
,
s
storage
.
Putt
er
,
mode
storage
.
ModePut
)
func
()
pipeline
.
ChainWriter
{
return
func
()
pipeline
.
ChainWriter
{
return
func
()
pipeline
.
ChainWriter
{
lsw
:=
store
.
NewStoreWriter
(
ctx
,
s
,
mode
,
nil
)
lsw
:=
store
.
NewStoreWriter
(
ctx
,
s
,
mode
,
nil
)
return
bmt
.
NewBmtWriter
(
lsw
)
return
bmt
.
NewBmtWriter
(
lsw
)
...
@@ -52,7 +52,7 @@ func newShortPipelineFunc(ctx context.Context, s storage.Storer, mode storage.Mo
...
@@ -52,7 +52,7 @@ func newShortPipelineFunc(ctx context.Context, s storage.Storer, mode storage.Mo
// writes are supported. The pipeline flow is: Data -> Feeder -> Encryption -> BMT -> Storage -> HashTrie.
// writes are supported. The pipeline flow is: Data -> Feeder -> Encryption -> BMT -> Storage -> HashTrie.
// Note that the encryption writer will mutate the data to contain the encrypted span, but the span field
// Note that the encryption writer will mutate the data to contain the encrypted span, but the span field
// with the unencrypted span is preserved.
// with the unencrypted span is preserved.
func
newEncryptionPipeline
(
ctx
context
.
Context
,
s
storage
.
Stor
er
,
mode
storage
.
ModePut
)
pipeline
.
Interface
{
func
newEncryptionPipeline
(
ctx
context
.
Context
,
s
storage
.
Putt
er
,
mode
storage
.
ModePut
)
pipeline
.
Interface
{
tw
:=
hashtrie
.
NewHashTrieWriter
(
swarm
.
ChunkSize
,
64
,
swarm
.
HashSize
+
encryption
.
KeyLength
,
newShortEncryptionPipelineFunc
(
ctx
,
s
,
mode
))
tw
:=
hashtrie
.
NewHashTrieWriter
(
swarm
.
ChunkSize
,
64
,
swarm
.
HashSize
+
encryption
.
KeyLength
,
newShortEncryptionPipelineFunc
(
ctx
,
s
,
mode
))
lsw
:=
store
.
NewStoreWriter
(
ctx
,
s
,
mode
,
tw
)
lsw
:=
store
.
NewStoreWriter
(
ctx
,
s
,
mode
,
tw
)
b
:=
bmt
.
NewBmtWriter
(
lsw
)
b
:=
bmt
.
NewBmtWriter
(
lsw
)
...
@@ -62,7 +62,7 @@ func newEncryptionPipeline(ctx context.Context, s storage.Storer, mode storage.M
...
@@ -62,7 +62,7 @@ func newEncryptionPipeline(ctx context.Context, s storage.Storer, mode storage.M
// newShortEncryptionPipelineFunc returns a constructor function for an ephemeral hashing pipeline
// newShortEncryptionPipelineFunc returns a constructor function for an ephemeral hashing pipeline
// needed by the hashTrieWriter.
// needed by the hashTrieWriter.
func
newShortEncryptionPipelineFunc
(
ctx
context
.
Context
,
s
storage
.
Stor
er
,
mode
storage
.
ModePut
)
func
()
pipeline
.
ChainWriter
{
func
newShortEncryptionPipelineFunc
(
ctx
context
.
Context
,
s
storage
.
Putt
er
,
mode
storage
.
ModePut
)
func
()
pipeline
.
ChainWriter
{
return
func
()
pipeline
.
ChainWriter
{
return
func
()
pipeline
.
ChainWriter
{
lsw
:=
store
.
NewStoreWriter
(
ctx
,
s
,
mode
,
nil
)
lsw
:=
store
.
NewStoreWriter
(
ctx
,
s
,
mode
,
nil
)
b
:=
bmt
.
NewBmtWriter
(
lsw
)
b
:=
bmt
.
NewBmtWriter
(
lsw
)
...
...
pkg/file/pipeline/store/store.go
View file @
e207becb
...
@@ -25,7 +25,7 @@ type storeWriter struct {
...
@@ -25,7 +25,7 @@ type storeWriter struct {
}
}
// NewStoreWriter returns a storeWriter. It just writes the given data
// NewStoreWriter returns a storeWriter. It just writes the given data
// to a given storage.
Stor
er.
// to a given storage.
Putt
er.
func
NewStoreWriter
(
ctx
context
.
Context
,
l
storage
.
Putter
,
mode
storage
.
ModePut
,
next
pipeline
.
ChainWriter
)
pipeline
.
ChainWriter
{
func
NewStoreWriter
(
ctx
context
.
Context
,
l
storage
.
Putter
,
mode
storage
.
ModePut
,
next
pipeline
.
ChainWriter
)
pipeline
.
ChainWriter
{
return
&
storeWriter
{
ctx
:
ctx
,
l
:
l
,
mode
:
mode
,
next
:
next
}
return
&
storeWriter
{
ctx
:
ctx
,
l
:
l
,
mode
:
mode
,
next
:
next
}
}
}
...
...
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