Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
bdaee9bc
Commit
bdaee9bc
authored
10 years ago
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some performance tweaks for the dagwriter write path
parent
6e0cfb32
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
blockservice/blockservice.go
blockservice/blockservice.go
+2
-2
merkledag/merkledag.go
merkledag/merkledag.go
+1
-1
util/util.go
util/util.go
+5
-1
No files found.
blockservice/blockservice.go
View file @
bdaee9bc
...
...
@@ -36,7 +36,7 @@ func NewBlockService(d ds.Datastore, rem exchange.Interface) (*BlockService, err
// AddBlock adds a particular block to the service, Putting it into the datastore.
func
(
s
*
BlockService
)
AddBlock
(
b
*
blocks
.
Block
)
(
u
.
Key
,
error
)
{
k
:=
b
.
Key
()
log
.
Debug
(
"blockservice: storing [%s] in datastore"
,
k
.
Pretty
()
)
log
.
Debug
(
"blockservice: storing [%s] in datastore"
,
k
)
// TODO(brian): define a block datastore with a Put method which accepts a
// block parameter
err
:=
s
.
Datastore
.
Put
(
k
.
DsKey
(),
b
.
Data
)
...
...
@@ -53,7 +53,7 @@ func (s *BlockService) AddBlock(b *blocks.Block) (u.Key, error) {
// GetBlock retrieves a particular block from the service,
// Getting it from the datastore using the key (hash).
func
(
s
*
BlockService
)
GetBlock
(
k
u
.
Key
)
(
*
blocks
.
Block
,
error
)
{
log
.
Debug
(
"BlockService GetBlock: '%s'"
,
k
.
Pretty
()
)
log
.
Debug
(
"BlockService GetBlock: '%s'"
,
k
)
datai
,
err
:=
s
.
Datastore
.
Get
(
k
.
DsKey
())
if
err
==
nil
{
log
.
Debug
(
"Blockservice: Got data in datastore."
)
...
...
This diff is collapsed.
Click to expand it.
merkledag/merkledag.go
View file @
bdaee9bc
...
...
@@ -175,7 +175,7 @@ type DAGService struct {
// Add adds a node to the DAGService, storing the block in the BlockService
func
(
n
*
DAGService
)
Add
(
nd
*
Node
)
(
u
.
Key
,
error
)
{
k
,
_
:=
nd
.
Key
()
log
.
Debug
(
"DagService Add [%s]
\n
"
,
k
.
Pretty
()
)
log
.
Debug
(
"DagService Add [%s]"
,
k
)
if
n
==
nil
{
return
""
,
fmt
.
Errorf
(
"DAGService is nil"
)
}
...
...
This diff is collapsed.
Click to expand it.
util/util.go
View file @
bdaee9bc
...
...
@@ -39,7 +39,11 @@ var ErrNotFound = ds.ErrNotFound
// Key is a string representation of multihash for use with maps.
type
Key
string
// Pretty returns Key in a b58 encoded string
// String returns Key in a b58 encoded string
func
(
k
Key
)
String
()
string
{
return
b58
.
Encode
([]
byte
(
k
))
}
func
(
k
Key
)
Pretty
()
string
{
return
b58
.
Encode
([]
byte
(
k
))
}
...
...
This diff is collapsed.
Click to expand it.
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