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-dms3
Commits
54032ce3
Commit
54032ce3
authored
Oct 22, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated vendoring
parent
701035d5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
6 additions
and
235 deletions
+6
-235
Godeps/Godeps.json
Godeps/Godeps.json
+5
-5
Godeps/_workspace/src/github.com/jbenet/datastore.go/keytransform/doc.go
...ce/src/github.com/jbenet/datastore.go/keytransform/doc.go
+0
-25
Godeps/_workspace/src/github.com/jbenet/datastore.go/keytransform/interface.go
.../github.com/jbenet/datastore.go/keytransform/interface.go
+0
-34
Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace/doc.go
...space/src/github.com/jbenet/datastore.go/namespace/doc.go
+0
-24
Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace/example_test.go
.../github.com/jbenet/datastore.go/namespace/example_test.go
+0
-30
Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace/namespace.go
...src/github.com/jbenet/datastore.go/namespace/namespace.go
+0
-44
Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace/namespace_test.go
...ithub.com/jbenet/datastore.go/namespace/namespace_test.go
+0
-72
net/handshake/pb/handshake.pb.go
net/handshake/pb/handshake.pb.go
+1
-1
No files found.
Godeps/Godeps.json
View file @
54032ce3
{
"ImportPath"
:
"github.com/jbenet/go-ipfs"
,
"GoVersion"
:
"go1.3
.3
"
,
"GoVersion"
:
"go1.3"
,
"Packages"
:
[
"./..."
],
...
...
@@ -66,14 +66,14 @@
"ImportPath"
:
"github.com/jbenet/commander"
,
"Rev"
:
"e0cf317891f0ab6f1ac64dfcb754b4fb5e69f7df"
},
{
"ImportPath"
:
"github.com/jbenet/go-datastore"
,
"Rev"
:
"da593f5071b3ce60bf45b548193863bc3c885c3c"
},
{
"ImportPath"
:
"github.com/jbenet/go-base58"
,
"Rev"
:
"568a28d73fd97651d3442392036a658b6976eed5"
},
{
"ImportPath"
:
"github.com/jbenet/go-datastore"
,
"Rev"
:
"da593f5071b3ce60bf45b548193863bc3c885c3c"
},
{
"ImportPath"
:
"github.com/jbenet/go-is-domain"
,
"Rev"
:
"93b717f2ae17838a265e30277275ee99ee7198d6"
...
...
Godeps/_workspace/src/github.com/jbenet/datastore.go/keytransform/doc.go
deleted
100644 → 0
View file @
701035d5
// Package keytransform introduces a Datastore Shim that transforms keys before
// passing them to its child. It can be used to manipulate what keys look like
// to the user, for example namespacing keys, reversing them, etc.
//
// Use the Wrap function to wrap a datastore with any KeyTransform.
// A KeyTransform is simply an interface with two functions, a conversion and
// its inverse. For example:
//
// import (
// ktds "github.com/jbenet/datastore.go/keytransform"
// ds "github.com/jbenet/datastore.go"
// )
//
// func reverseKey(k ds.Key) ds.Key {
// return k.Reverse()
// }
//
// func invertKeys(d ds.Datastore) {
// return ktds.Wrap(d, &ktds.Pair{
// Convert: reverseKey,
// Invert: reverseKey, // reverse is its own inverse.
// })
// }
//
package
keytransform
Godeps/_workspace/src/github.com/jbenet/datastore.go/keytransform/interface.go
deleted
100644 → 0
View file @
701035d5
package
keytransform
import
ds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
// KeyMapping is a function that maps one key to annother
type
KeyMapping
func
(
ds
.
Key
)
ds
.
Key
// KeyTransform is an object with a pair of functions for (invertibly)
// transforming keys
type
KeyTransform
interface
{
ConvertKey
(
ds
.
Key
)
ds
.
Key
InvertKey
(
ds
.
Key
)
ds
.
Key
}
// Datastore is a keytransform.Datastore
type
Datastore
interface
{
ds
.
Shim
KeyTransform
}
// Wrap wraps a given datastore with a KeyTransform function.
// The resulting wrapped datastore will use the transform on all Datastore
// operations.
func
Wrap
(
child
ds
.
Datastore
,
t
KeyTransform
)
Datastore
{
if
t
==
nil
{
panic
(
"t (KeyTransform) is nil"
)
}
if
child
==
nil
{
panic
(
"child (ds.Datastore) is nil"
)
}
return
&
ktds
{
child
:
child
,
KeyTransform
:
t
}
}
Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace/doc.go
deleted
100644 → 0
View file @
701035d5
// Package namespace introduces a namespace Datastore Shim, which basically
// mounts the entire child datastore under a prefix.
//
// Use the Wrap function to wrap a datastore with any Key prefix. For example:
//
// import (
// "fmt"
//
// ds "github.com/jbenet/datastore.go"
// nsds "github.com/jbenet/datastore.go/namespace"
// )
//
// func main() {
// mp := ds.NewMapDatastore()
// ns := nsds.Wrap(mp, ds.NewKey("/foo/bar"))
//
// // in the Namespace Datastore:
// ns.Put(ds.NewKey("/beep"), "boop")
// v2, _ := ns.Get(ds.NewKey("/beep")) // v2 == "boop"
//
// // and, in the underlying MapDatastore:
// v3, _ := mp.Get(ds.NewKey("/foo/bar/beep")) // v3 == "boop"
// }
package
namespace
Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace/example_test.go
deleted
100644 → 0
View file @
701035d5
package
namespace_test
import
(
"fmt"
ds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
nsds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace"
)
func
Example
()
{
mp
:=
ds
.
NewMapDatastore
()
ns
:=
nsds
.
Wrap
(
mp
,
ds
.
NewKey
(
"/foo/bar"
))
k
:=
ds
.
NewKey
(
"/beep"
)
v
:=
"boop"
ns
.
Put
(
k
,
v
)
fmt
.
Printf
(
"ns.Put %s %s
\n
"
,
k
,
v
)
v2
,
_
:=
ns
.
Get
(
k
)
fmt
.
Printf
(
"ns.Get %s -> %s
\n
"
,
k
,
v2
)
k3
:=
ds
.
NewKey
(
"/foo/bar/beep"
)
v3
,
_
:=
mp
.
Get
(
k3
)
fmt
.
Printf
(
"mp.Get %s -> %s
\n
"
,
k3
,
v3
)
// Output:
// ns.Put /beep -> boop
// ns.Get /beep -> boop
// mp.Get /foo/bar/beep -> boop
}
Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace/namespace.go
deleted
100644 → 0
View file @
701035d5
package
namespace
import
(
"fmt"
"strings"
ds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
ktds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go/keytransform"
)
// PrefixTransform constructs a KeyTransform with a pair of functions that
// add or remove the given prefix key.
//
// Warning: will panic if prefix not found when it should be there. This is
// to avoid insidious data inconsistency errors.
func
PrefixTransform
(
prefix
ds
.
Key
)
ktds
.
KeyTransform
{
return
&
ktds
.
Pair
{
// Convert adds the prefix
Convert
:
func
(
k
ds
.
Key
)
ds
.
Key
{
return
prefix
.
Child
(
k
)
},
// Invert removes the prefix. panics if prefix not found.
Invert
:
func
(
k
ds
.
Key
)
ds
.
Key
{
if
!
prefix
.
IsAncestorOf
(
k
)
{
fmt
.
Errorf
(
"Expected prefix (%s) in key (%s)"
,
prefix
,
k
)
panic
(
"expected prefix not found"
)
}
s
:=
strings
.
TrimPrefix
(
k
.
String
(),
prefix
.
String
())
return
ds
.
NewKey
(
s
)
},
}
}
// Wrap wraps a given datastore with a key-prefix.
func
Wrap
(
child
ds
.
Datastore
,
prefix
ds
.
Key
)
ktds
.
Datastore
{
if
child
==
nil
{
panic
(
"child (ds.Datastore) is nil"
)
}
return
ktds
.
Wrap
(
child
,
PrefixTransform
(
prefix
))
}
Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace/namespace_test.go
deleted
100644 → 0
View file @
701035d5
package
namespace_test
import
(
"bytes"
"sort"
"testing"
ds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
ns
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go/namespace"
.
"launchpad.net/gocheck"
)
// Hook up gocheck into the "go test" runner.
func
Test
(
t
*
testing
.
T
)
{
TestingT
(
t
)
}
type
DSSuite
struct
{}
var
_
=
Suite
(
&
DSSuite
{})
func
(
ks
*
DSSuite
)
TestBasic
(
c
*
C
)
{
mpds
:=
ds
.
NewMapDatastore
()
nsds
:=
ns
.
Wrap
(
mpds
,
ds
.
NewKey
(
"abc"
))
keys
:=
strsToKeys
([]
string
{
"foo"
,
"foo/bar"
,
"foo/bar/baz"
,
"foo/barb"
,
"foo/bar/bazb"
,
"foo/bar/baz/barb"
,
})
for
_
,
k
:=
range
keys
{
err
:=
nsds
.
Put
(
k
,
[]
byte
(
k
.
String
()))
c
.
Check
(
err
,
Equals
,
nil
)
}
for
_
,
k
:=
range
keys
{
v1
,
err
:=
nsds
.
Get
(
k
)
c
.
Check
(
err
,
Equals
,
nil
)
c
.
Check
(
bytes
.
Equal
(
v1
.
([]
byte
),
[]
byte
(
k
.
String
())),
Equals
,
true
)
v2
,
err
:=
mpds
.
Get
(
ds
.
NewKey
(
"abc"
)
.
Child
(
k
))
c
.
Check
(
err
,
Equals
,
nil
)
c
.
Check
(
bytes
.
Equal
(
v2
.
([]
byte
),
[]
byte
(
k
.
String
())),
Equals
,
true
)
}
listA
,
errA
:=
mpds
.
KeyList
()
listB
,
errB
:=
nsds
.
KeyList
()
c
.
Check
(
errA
,
Equals
,
nil
)
c
.
Check
(
errB
,
Equals
,
nil
)
c
.
Check
(
len
(
listA
),
Equals
,
len
(
listB
))
// sort them cause yeah.
sort
.
Sort
(
ds
.
KeySlice
(
listA
))
sort
.
Sort
(
ds
.
KeySlice
(
listB
))
for
i
,
kA
:=
range
listA
{
kB
:=
listB
[
i
]
c
.
Check
(
nsds
.
InvertKey
(
kA
),
Equals
,
kB
)
c
.
Check
(
kA
,
Equals
,
nsds
.
ConvertKey
(
kB
))
}
}
func
strsToKeys
(
strs
[]
string
)
[]
ds
.
Key
{
keys
:=
make
([]
ds
.
Key
,
len
(
strs
))
for
i
,
s
:=
range
strs
{
keys
[
i
]
=
ds
.
NewKey
(
s
)
}
return
keys
}
net/handshake/pb/handshake.pb.go
View file @
54032ce3
...
...
@@ -14,7 +14,7 @@ It has these top-level messages:
*/
package
handshake_pb
import
proto
"code.google.com/p/gogoprotobuf/proto"
import
proto
"
github.com/jbenet/go-ipfs/Godeps/_workspace/src/
code.google.com/p/gogoprotobuf/proto"
import
json
"encoding/json"
import
math
"math"
...
...
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