Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
fe86a707
Commit
fe86a707
authored
Dec 18, 2018
by
Javier Peletier
Committed by
Anton Evangelatov
Dec 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm/storage: remove unused methods from Chunk interface (#18283)
parent
b01cfce3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
21 deletions
+4
-21
common_test.go
swarm/storage/common_test.go
+3
-2
memstore.go
swarm/storage/memstore.go
+1
-1
types.go
swarm/storage/types.go
+0
-18
No files found.
swarm/storage/common_test.go
View file @
fe86a707
...
@@ -179,8 +179,9 @@ func testStoreCorrect(m ChunkStore, n int, chunksize int64, t *testing.T) {
...
@@ -179,8 +179,9 @@ func testStoreCorrect(m ChunkStore, n int, chunksize int64, t *testing.T) {
return
fmt
.
Errorf
(
"key does not match retrieved chunk Address"
)
return
fmt
.
Errorf
(
"key does not match retrieved chunk Address"
)
}
}
hasher
:=
MakeHashFunc
(
DefaultHash
)()
hasher
:=
MakeHashFunc
(
DefaultHash
)()
hasher
.
ResetWithLength
(
chunk
.
SpanBytes
())
data
:=
chunk
.
Data
()
hasher
.
Write
(
chunk
.
Payload
())
hasher
.
ResetWithLength
(
data
[
:
8
])
hasher
.
Write
(
data
[
8
:
])
exp
:=
hasher
.
Sum
(
nil
)
exp
:=
hasher
.
Sum
(
nil
)
if
!
bytes
.
Equal
(
h
,
exp
)
{
if
!
bytes
.
Equal
(
h
,
exp
)
{
return
fmt
.
Errorf
(
"key is not hash of chunk data"
)
return
fmt
.
Errorf
(
"key is not hash of chunk data"
)
...
...
swarm/storage/memstore.go
View file @
fe86a707
...
@@ -57,7 +57,7 @@ func (m *MemStore) Get(_ context.Context, addr Address) (Chunk, error) {
...
@@ -57,7 +57,7 @@ func (m *MemStore) Get(_ context.Context, addr Address) (Chunk, error) {
if
!
ok
{
if
!
ok
{
return
nil
,
ErrChunkNotFound
return
nil
,
ErrChunkNotFound
}
}
return
c
.
(
*
c
hunk
),
nil
return
c
.
(
C
hunk
),
nil
}
}
func
(
m
*
MemStore
)
Put
(
_
context
.
Context
,
c
Chunk
)
error
{
func
(
m
*
MemStore
)
Put
(
_
context
.
Context
,
c
Chunk
)
error
{
...
...
swarm/storage/types.go
View file @
fe86a707
...
@@ -184,9 +184,6 @@ func (c AddressCollection) Swap(i, j int) {
...
@@ -184,9 +184,6 @@ func (c AddressCollection) Swap(i, j int) {
// Chunk interface implemented by context.Contexts and data chunks
// Chunk interface implemented by context.Contexts and data chunks
type
Chunk
interface
{
type
Chunk
interface
{
Address
()
Address
Address
()
Address
Payload
()
[]
byte
SpanBytes
()
[]
byte
Span
()
int64
Data
()
[]
byte
Data
()
[]
byte
}
}
...
@@ -208,25 +205,10 @@ func (c *chunk) Address() Address {
...
@@ -208,25 +205,10 @@ func (c *chunk) Address() Address {
return
c
.
addr
return
c
.
addr
}
}
func
(
c
*
chunk
)
SpanBytes
()
[]
byte
{
return
c
.
sdata
[
:
8
]
}
func
(
c
*
chunk
)
Span
()
int64
{
if
c
.
span
==
-
1
{
c
.
span
=
int64
(
binary
.
LittleEndian
.
Uint64
(
c
.
sdata
[
:
8
]))
}
return
c
.
span
}
func
(
c
*
chunk
)
Data
()
[]
byte
{
func
(
c
*
chunk
)
Data
()
[]
byte
{
return
c
.
sdata
return
c
.
sdata
}
}
func
(
c
*
chunk
)
Payload
()
[]
byte
{
return
c
.
sdata
[
8
:
]
}
// String() for pretty printing
// String() for pretty printing
func
(
self
*
chunk
)
String
()
string
{
func
(
self
*
chunk
)
String
()
string
{
return
fmt
.
Sprintf
(
"Address: %v TreeSize: %v Chunksize: %v"
,
self
.
addr
.
Log
(),
self
.
span
,
len
(
self
.
sdata
))
return
fmt
.
Sprintf
(
"Address: %v TreeSize: %v Chunksize: %v"
,
self
.
addr
.
Log
(),
self
.
span
,
len
(
self
.
sdata
))
...
...
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