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
30bc8903
Commit
30bc8903
authored
Jan 20, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ce695ff1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
t/neo/proto.go
t/neo/proto.go
+2
-2
t/neo/protogen.go
t/neo/protogen.go
+13
-7
No files found.
t/neo/proto.go
View file @
30bc8903
...
@@ -444,7 +444,7 @@ type StoreObject struct {
...
@@ -444,7 +444,7 @@ type StoreObject struct {
Serial
Tid
Serial
Tid
Compression
bool
Compression
bool
Checksum
Checksum
Checksum
Checksum
Data
[]
byte
//
XXX or string ?
Data
[]
byte
//
TODO separately (for writev)
DataSerial
Tid
DataSerial
Tid
Tid
Tid
Tid
Tid
Unlock
bool
Unlock
bool
...
@@ -496,7 +496,7 @@ type AnswerGetObject struct {
...
@@ -496,7 +496,7 @@ type AnswerGetObject struct {
SerialEnd
Tid
SerialEnd
Tid
Compression
bool
Compression
bool
Checksum
Checksum
Checksum
Checksum
Data
[]
byte
//
XXX or string ?
Data
[]
byte
//
TODO separately (for writev)
DataSerial
Tid
DataSerial
Tid
}
}
...
...
t/neo/protogen.go
View file @
30bc8903
...
@@ -166,7 +166,7 @@ var basicTypes = map[types.BasicKind]basicCodec {
...
@@ -166,7 +166,7 @@ var basicTypes = map[types.BasicKind]basicCodec {
types
.
Float64
:
{
8
,
"float64_NEOEncode(%v, %v)"
,
"float64_NEODecode(%v)"
},
types
.
Float64
:
{
8
,
"float64_NEOEncode(%v, %v)"
,
"float64_NEODecode(%v)"
},
}
}
// does a type have fixed wire size and
what it is
// does a type have fixed wire size and
, if yes, what it is?
func
typeSizeFixed
(
typ
types
.
Type
)
(
wireSize
int
,
ok
bool
)
{
func
typeSizeFixed
(
typ
types
.
Type
)
(
wireSize
int
,
ok
bool
)
{
switch
u
:=
typ
.
Underlying
()
.
(
type
)
{
switch
u
:=
typ
.
Underlying
()
.
(
type
)
{
case
*
types
.
Basic
:
case
*
types
.
Basic
:
...
@@ -185,6 +185,12 @@ func typeSizeFixed(typ types.Type) (wireSize int, ok bool) {
...
@@ -185,6 +185,12 @@ func typeSizeFixed(typ types.Type) (wireSize int, ok bool) {
}
}
return
wireSize
,
true
return
wireSize
,
true
case
*
types
.
Array
:
elemSize
,
ok
:=
typeSizeFixed
(
u
.
Elem
())
if
ok
{
return
int
(
u
.
Len
())
*
elemSize
,
ok
}
}
}
notfixed
:
notfixed
:
...
@@ -498,6 +504,12 @@ func codegenType(path string, typ types.Type, obj types.Object, codegen CodecCod
...
@@ -498,6 +504,12 @@ func codegenType(path string, typ types.Type, obj types.Object, codegen CodecCod
}
}
codegen
.
genBasic
(
path
,
u
,
typ
,
obj
)
codegen
.
genBasic
(
path
,
u
,
typ
,
obj
)
case
*
types
.
Struct
:
for
i
:=
0
;
i
<
u
.
NumFields
();
i
++
{
v
:=
u
.
Field
(
i
)
codegenType
(
path
+
"."
+
v
.
Name
(),
v
.
Type
(),
v
,
codegen
)
}
case
*
types
.
Array
:
case
*
types
.
Array
:
// TODO optimize for [...]byte
// TODO optimize for [...]byte
var
i
int64
// XXX because `u.Len() int64`
var
i
int64
// XXX because `u.Len() int64`
...
@@ -505,12 +517,6 @@ func codegenType(path string, typ types.Type, obj types.Object, codegen CodecCod
...
@@ -505,12 +517,6 @@ func codegenType(path string, typ types.Type, obj types.Object, codegen CodecCod
codegenType
(
fmt
.
Sprintf
(
"%v[%v]"
,
path
,
i
),
u
.
Elem
(),
obj
,
codegen
)
codegenType
(
fmt
.
Sprintf
(
"%v[%v]"
,
path
,
i
),
u
.
Elem
(),
obj
,
codegen
)
}
}
case
*
types
.
Struct
:
for
i
:=
0
;
i
<
u
.
NumFields
();
i
++
{
v
:=
u
.
Field
(
i
)
codegenType
(
path
+
"."
+
v
.
Name
(),
v
.
Type
(),
v
,
codegen
)
}
case
*
types
.
Slice
:
case
*
types
.
Slice
:
codegen
.
genSlice
(
path
,
u
,
obj
)
codegen
.
genSlice
(
path
,
u
,
obj
)
...
...
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