Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
5c660da3
Commit
5c660da3
authored
Jun 19, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X . (non-local imports finish)
parent
da44885f
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
54 additions
and
34 deletions
+54
-34
go/neo/connection_test.go
go/neo/connection_test.go
+1
-1
go/neo/proto-marshal.go
go/neo/proto-marshal.go
+1
-1
go/neo/proto.go
go/neo/proto.go
+1
-1
go/neo/proto_test.go
go/neo/proto_test.go
+1
-1
go/neo/protogen.go
go/neo/protogen.go
+32
-12
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+9
-9
go/neo/x_connection.go
go/neo/x_connection.go
+1
-1
go/xcommon/xnet/pipenet/pipenet_test.go
go/xcommon/xnet/pipenet/pipenet_test.go
+1
-1
go/zodb/storage/fs1/filestorage_test.go
go/zodb/storage/fs1/filestorage_test.go
+1
-1
go/zodb/storage/fs1/index_test.go
go/zodb/storage/fs1/index_test.go
+2
-2
go/zodb/storage/fs1/py/gen-testdata
go/zodb/storage/fs1/py/gen-testdata
+1
-1
go/zodb/storage/fs1/testdata_expect_test.go
go/zodb/storage/fs1/testdata_expect_test.go
+1
-1
go/zodb/zodbtools/dump_test.go
go/zodb/zodbtools/dump_test.go
+2
-2
No files found.
go/neo/connection_test.go
View file @
5c660da3
...
...
@@ -26,7 +26,7 @@ import (
"testing"
"time"
"
..
/xcommon/xsync"
"
lab.nexedi.com/kirr/neo/go
/xcommon/xsync"
"lab.nexedi.com/kirr/go123/exc"
"lab.nexedi.com/kirr/go123/xerr"
...
...
go/neo/proto-marshal.go
View file @
5c660da3
...
...
@@ -7,7 +7,7 @@ import (
"reflect"
"sort"
"
..
/zodb"
"
lab.nexedi.com/kirr/neo/go
/zodb"
)
// messages marshalling
...
...
go/neo/proto.go
View file @
5c660da3
...
...
@@ -13,7 +13,7 @@ package neo
// XXX move imports out of here
import
(
"
..
/zodb"
"
lab.nexedi.com/kirr/neo/go
/zodb"
"encoding/binary"
"errors"
...
...
go/neo/proto_test.go
View file @
5c660da3
...
...
@@ -28,7 +28,7 @@ import (
"testing"
"unsafe"
"
..
/zodb"
"
lab.nexedi.com/kirr/neo/go
/zodb"
)
// decode string as hex; panic on error
...
...
go/neo/protogen.go
View file @
5c660da3
...
...
@@ -77,7 +77,7 @@ import (
// parsed & typechecked input
var
fset
=
token
.
NewFileSet
()
var
fileMap
=
map
[
string
]
*
ast
.
File
{}
// fileName -> AST
var
pkgMap
=
map
[
string
]
*
types
.
Package
{}
// pkg
Name
-> Package
var
pkgMap
=
map
[
string
]
*
types
.
Package
{}
// pkg
Path
-> Package
var
typeInfo
=
&
types
.
Info
{
Types
:
make
(
map
[
ast
.
Expr
]
types
.
TypeAndValue
),
Defs
:
make
(
map
[
*
ast
.
Ident
]
types
.
Object
),
...
...
@@ -88,10 +88,30 @@ func pos(x interface { Pos() token.Pos }) token.Position {
return
fset
.
Position
(
x
.
Pos
())
}
// get type name relative to neo package
var
neoQualifier
types
.
Qualifier
// get type name in context of neo package
var
(
zodbPkg
*
types
.
Package
neoPkg
*
types
.
Package
)
func
typeName
(
typ
types
.
Type
)
string
{
return
types
.
TypeString
(
typ
,
neoQualifier
)
qf
:=
func
(
pkg
*
types
.
Package
)
string
{
switch
pkg
{
case
neoPkg
:
// same package - unqualified
return
""
case
zodbPkg
:
// zodb is imported - only name
return
pkg
.
Name
()
default
:
// fully qualified otherwise
return
pkg
.
Path
()
}
}
return
types
.
TypeString
(
typ
,
qf
)
}
// bytes.Buffer + bell & whistles
...
...
@@ -110,8 +130,9 @@ type localImporter struct {
}
func
(
li
*
localImporter
)
Import
(
path
string
)
(
*
types
.
Package
,
error
)
{
xpath
:=
strings
.
TrimPrefix
(
path
,
"../"
)
// ../zodb -> zodb
pkg
:=
pkgMap
[
xpath
]
// xpath := strings.TrimPrefix(path, "../") // ../zodb -> zodb
// pkg := pkgMap[xpath]
pkg
:=
pkgMap
[
path
]
if
pkg
!=
nil
{
return
pkg
,
nil
}
...
...
@@ -119,7 +140,7 @@ func (li *localImporter) Import(path string) (*types.Package, error) {
return
li
.
Importer
.
Import
(
path
)
}
func
loadPkg
(
pkg
Name
string
,
sources
...
string
)
*
types
.
Package
{
func
loadPkg
(
pkg
Path
string
,
sources
...
string
)
*
types
.
Package
{
var
filev
[]
*
ast
.
File
// parse
...
...
@@ -137,11 +158,11 @@ func loadPkg(pkgName string, sources ...string) *types.Package {
// typecheck
conf
:=
types
.
Config
{
Importer
:
&
localImporter
{
importer
.
Default
()}}
pkg
,
err
:=
conf
.
Check
(
pkg
Name
,
fset
,
filev
,
typeInfo
)
pkg
,
err
:=
conf
.
Check
(
pkg
Path
,
fset
,
filev
,
typeInfo
)
if
err
!=
nil
{
log
.
Fatalf
(
"typecheck: %v"
,
err
)
}
pkgMap
[
pkg
Name
]
=
pkg
pkgMap
[
pkg
Path
]
=
pkg
return
pkg
}
...
...
@@ -151,9 +172,8 @@ func main() {
log
.
SetFlags
(
0
)
// go through proto.go and AST'ify & typecheck it
loadPkg
(
"zodb"
,
"../zodb/zodb.go"
)
loadPkg
(
"neo"
,
"proto.go"
,
"neo.go"
)
neoQualifier
=
types
.
RelativeTo
(
pkgMap
[
"neo"
])
zodbPkg
=
loadPkg
(
"lab.nexedi.com/kirr/neo/go/zodb"
,
"../zodb/zodb.go"
)
neoPkg
=
loadPkg
(
"lab.nexedi.com/kirr/neo/go/neo"
,
"proto.go"
,
"neo.go"
)
// prologue
f
:=
fileMap
[
"proto.go"
]
...
...
go/neo/server/cluster_test.go
View file @
5c660da3
...
...
@@ -25,17 +25,17 @@ import (
//"reflect"
"testing"
"
../..
/neo"
//"
../..
/neo/client"
"
lab.nexedi.com/kirr/neo/go
/neo"
//"
lab.nexedi.com/kirr/neo/go
/neo/client"
//"
../..
/zodb"
"
../..
/zodb/storage/fs1"
//"
lab.nexedi.com/kirr/neo/go
/zodb"
"
lab.nexedi.com/kirr/neo/go
/zodb/storage/fs1"
"
../..
/xcommon/tracing"
"
../..
/xcommon/xnet"
"
../..
/xcommon/xnet/pipenet"
"
../..
/xcommon/xsync"
"
../..
/xcommon/xtesting"
"
lab.nexedi.com/kirr/neo/go
/xcommon/tracing"
"
lab.nexedi.com/kirr/neo/go
/xcommon/xnet"
"
lab.nexedi.com/kirr/neo/go
/xcommon/xnet/pipenet"
"
lab.nexedi.com/kirr/neo/go
/xcommon/xsync"
"
lab.nexedi.com/kirr/neo/go
/xcommon/xtesting"
"lab.nexedi.com/kirr/go123/exc"
...
...
go/neo/x_connection.go
View file @
5c660da3
...
...
@@ -4,7 +4,7 @@ package neo
import
(
"fmt"
"
..
/zodb"
"
lab.nexedi.com/kirr/neo/go
/zodb"
"lab.nexedi.com/kirr/go123/xerr"
)
...
...
go/xcommon/xnet/pipenet/pipenet_test.go
View file @
5c660da3
...
...
@@ -25,7 +25,7 @@ import (
"reflect"
"testing"
"
../../..
/xcommon/xsync"
"
lab.nexedi.com/kirr/neo/go
/xcommon/xsync"
"lab.nexedi.com/kirr/go123/exc"
)
...
...
go/zodb/storage/fs1/filestorage_test.go
View file @
5c660da3
...
...
@@ -24,7 +24,7 @@ import (
"reflect"
"testing"
"
../../..
/zodb"
"
lab.nexedi.com/kirr/neo/go
/zodb"
"lab.nexedi.com/kirr/go123/exc"
)
...
...
go/zodb/storage/fs1/index_test.go
View file @
5c660da3
...
...
@@ -29,8 +29,8 @@ import (
"strings"
"testing"
"
../../..
/zodb"
"
.
/fsb"
"
lab.nexedi.com/kirr/neo/go
/zodb"
"
lab.nexedi.com/kirr/neo/go/zodb/storage/fs1
/fsb"
)
type
indexEntry
struct
{
...
...
go/zodb/storage/fs1/py/gen-testdata
View file @
5c660da3
...
...
@@ -182,7 +182,7 @@ def main():
print
>>
f
,
v
emit
(
"// DO NOT EDIT - AUTOGENERATED (by py/gen-testdata)"
)
emit
(
"package fs1
\
n
"
)
emit
(
"import
\
"
../../..
/zodb
\
"
\
n
"
)
emit
(
"import
\
"
lab.nexedi.com/kirr/neo/go
/zodb
\
"
\
n
"
)
# index
emit
(
"const _1fs_indexTopPos = %i"
%
stor
.
_pos
)
...
...
go/zodb/storage/fs1/testdata_expect_test.go
View file @
5c660da3
// DO NOT EDIT - AUTOGENERATED (by py/gen-testdata)
package
fs1
import
"
../../..
/zodb"
import
"
lab.nexedi.com/kirr/neo/go
/zodb"
const
_1fs_indexTopPos
=
12226
var
_1fs_indexEntryv
=
[
...
]
indexEntry
{
...
...
go/zodb/zodbtools/dump_test.go
View file @
5c660da3
...
...
@@ -26,8 +26,8 @@ import (
"regexp"
"testing"
"
../..
/zodb/storage/fs1"
"
../..
/zodb"
"
lab.nexedi.com/kirr/neo/go
/zodb/storage/fs1"
"
lab.nexedi.com/kirr/neo/go
/zodb"
"github.com/sergi/go-diff/diffmatchpatch"
"lab.nexedi.com/kirr/go123/exc"
...
...
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