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-datastore
Commits
09045306
Commit
09045306
authored
Jul 02, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vendor correctly
parent
df0989a3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
99 additions
and
5 deletions
+99
-5
Godeps/Godeps.json
Godeps/Godeps.json
+8
-4
Godeps/_workspace/src/github.com/dustin/randbo/.gitignore
Godeps/_workspace/src/github.com/dustin/randbo/.gitignore
+2
-0
Godeps/_workspace/src/github.com/dustin/randbo/README.markdown
...s/_workspace/src/github.com/dustin/randbo/README.markdown
+11
-0
Godeps/_workspace/src/github.com/dustin/randbo/randbo.go
Godeps/_workspace/src/github.com/dustin/randbo/randbo.go
+40
-0
Godeps/_workspace/src/github.com/dustin/randbo/randbo.png
Godeps/_workspace/src/github.com/dustin/randbo/randbo.png
+0
-0
Godeps/_workspace/src/github.com/dustin/randbo/randbo_test.go
...ps/_workspace/src/github.com/dustin/randbo/randbo_test.go
+37
-0
flatfs/flatfs_test.go
flatfs/flatfs_test.go
+1
-1
No files found.
Godeps/Godeps.json
View file @
09045306
...
@@ -17,6 +17,10 @@
...
@@ -17,6 +17,10 @@
"ImportPath"
:
"github.com/codahale/metrics"
,
"ImportPath"
:
"github.com/codahale/metrics"
,
"Rev"
:
"7d3beb1b480077e77c08a6f6c65ea969f6e91420"
"Rev"
:
"7d3beb1b480077e77c08a6f6c65ea969f6e91420"
},
},
{
"ImportPath"
:
"github.com/dustin/randbo"
,
"Rev"
:
"7f1b564ca7242d22bcc6e2128beb90d9fa38b9f0"
},
{
{
"ImportPath"
:
"github.com/hashicorp/golang-lru"
,
"ImportPath"
:
"github.com/hashicorp/golang-lru"
,
"Rev"
:
"4dfff096c4973178c8f35cf6dd1a732a0a139370"
"Rev"
:
"4dfff096c4973178c8f35cf6dd1a732a0a139370"
...
@@ -29,10 +33,6 @@
...
@@ -29,10 +33,6 @@
"ImportPath"
:
"github.com/jbenet/goprocess"
,
"ImportPath"
:
"github.com/jbenet/goprocess"
,
"Rev"
:
"5b02f8d275a2dd882fb06f8bbdf74347795ff3b1"
"Rev"
:
"5b02f8d275a2dd882fb06f8bbdf74347795ff3b1"
},
},
{
"ImportPath"
:
"github.com/satori/go.uuid"
,
"Rev"
:
"7c7f2020c4c9491594b85767967f4619c2fa75f9"
},
{
{
"ImportPath"
:
"github.com/mattbaird/elastigo/api"
,
"ImportPath"
:
"github.com/mattbaird/elastigo/api"
,
"Rev"
:
"041b88c1fcf6489a5721ede24378ce1253b9159d"
"Rev"
:
"041b88c1fcf6489a5721ede24378ce1253b9159d"
...
@@ -41,6 +41,10 @@
...
@@ -41,6 +41,10 @@
"ImportPath"
:
"github.com/mattbaird/elastigo/core"
,
"ImportPath"
:
"github.com/mattbaird/elastigo/core"
,
"Rev"
:
"041b88c1fcf6489a5721ede24378ce1253b9159d"
"Rev"
:
"041b88c1fcf6489a5721ede24378ce1253b9159d"
},
},
{
"ImportPath"
:
"github.com/satori/go.uuid"
,
"Rev"
:
"7c7f2020c4c9491594b85767967f4619c2fa75f9"
},
{
{
"ImportPath"
:
"github.com/syndtr/goleveldb/leveldb"
,
"ImportPath"
:
"github.com/syndtr/goleveldb/leveldb"
,
"Rev"
:
"871eee0a7546bb7d1b2795142e29c4534abc49b3"
"Rev"
:
"871eee0a7546bb7d1b2795142e29c4534abc49b3"
...
...
Godeps/_workspace/src/github.com/dustin/randbo/.gitignore
0 → 100644
View file @
09045306
*~
Godeps/_workspace/src/github.com/dustin/randbo/README.markdown
0 → 100644
View file @
09045306
A fast random number
`io.Reader`
implementation.
![
randbo
](
https://raw.github.com/dustin/randbo/master/randbo.png
)
> IN A WORLD where no integer sequence is certain ...
>
> ONE MAN must become statistically indistinguishable from noise
>
> THIS SUMMER, entropy has a new name: RANDBO
(thanks @snej)
Godeps/_workspace/src/github.com/dustin/randbo/randbo.go
0 → 100644
View file @
09045306
package
randbo
import
(
"io"
"math/rand"
"time"
)
// Randbo creates a stream of non-crypto quality random bytes
type
randbo
struct
{
rand
.
Source
}
// New creates a new random reader with a time source.
func
New
()
io
.
Reader
{
return
NewFrom
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
}
// NewFrom creates a new reader from your own rand.Source
func
NewFrom
(
src
rand
.
Source
)
io
.
Reader
{
return
&
randbo
{
src
}
}
// Read satisfies io.Reader
func
(
r
*
randbo
)
Read
(
p
[]
byte
)
(
n
int
,
err
error
)
{
todo
:=
len
(
p
)
offset
:=
0
for
{
val
:=
int64
(
r
.
Int63
())
for
i
:=
0
;
i
<
8
;
i
++
{
p
[
offset
]
=
byte
(
val
)
todo
--
if
todo
==
0
{
return
len
(
p
),
nil
}
offset
++
val
>>=
8
}
}
}
Godeps/_workspace/src/github.com/dustin/randbo/randbo.png
0 → 100644
View file @
09045306
242 KB
Godeps/_workspace/src/github.com/dustin/randbo/randbo_test.go
0 → 100644
View file @
09045306
package
randbo
import
(
"crypto/rand"
"io"
"io/ioutil"
"testing"
)
func
TestRandbo
(
t
*
testing
.
T
)
{
buf
:=
make
([]
byte
,
16
)
n
,
err
:=
New
()
.
Read
(
buf
)
if
err
!=
nil
{
t
.
Fatalf
(
"Error reading: %v"
,
err
)
}
if
n
!=
len
(
buf
)
{
t
.
Fatalf
(
"Short read: %v"
,
n
)
}
t
.
Logf
(
"Read %x"
,
buf
)
}
const
toCopy
=
1024
*
1024
func
BenchmarkRandbo
(
b
*
testing
.
B
)
{
b
.
SetBytes
(
toCopy
)
r
:=
New
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
io
.
CopyN
(
ioutil
.
Discard
,
r
,
toCopy
)
}
}
func
BenchmarkCrypto
(
b
*
testing
.
B
)
{
b
.
SetBytes
(
toCopy
)
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
io
.
CopyN
(
ioutil
.
Discard
,
rand
.
Reader
,
toCopy
)
}
}
flatfs/flatfs_test.go
View file @
09045306
...
@@ -12,7 +12,7 @@ import (
...
@@ -12,7 +12,7 @@ import (
"github.com/jbenet/go-datastore/flatfs"
"github.com/jbenet/go-datastore/flatfs"
"github.com/jbenet/go-datastore/query"
"github.com/jbenet/go-datastore/query"
rand
"github.com/dustin/randbo"
rand
"github.com/
jbenet/go-datastore/Godeps/_workspace/src/github.com/
dustin/randbo"
)
)
func
tempdir
(
t
testing
.
TB
)
(
path
string
,
cleanup
func
())
{
func
tempdir
(
t
testing
.
TB
)
(
path
string
,
cleanup
func
())
{
...
...
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