Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
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 {
Serial
Tid
Compression
bool
Checksum
Checksum
Data
[]
byte
//
XXX or string ?
Data
[]
byte
//
TODO separately (for writev)
DataSerial
Tid
Tid
Tid
Unlock
bool
...
...
@@ -496,7 +496,7 @@ type AnswerGetObject struct {
SerialEnd
Tid
Compression
bool
Checksum
Checksum
Data
[]
byte
//
XXX or string ?
Data
[]
byte
//
TODO separately (for writev)
DataSerial
Tid
}
...
...
t/neo/protogen.go
View file @
30bc8903
...
...
@@ -166,7 +166,7 @@ var basicTypes = map[types.BasicKind]basicCodec {
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
)
{
switch
u
:=
typ
.
Underlying
()
.
(
type
)
{
case
*
types
.
Basic
:
...
...
@@ -185,6 +185,12 @@ func typeSizeFixed(typ types.Type) (wireSize int, ok bool) {
}
return
wireSize
,
true
case
*
types
.
Array
:
elemSize
,
ok
:=
typeSizeFixed
(
u
.
Elem
())
if
ok
{
return
int
(
u
.
Len
())
*
elemSize
,
ok
}
}
notfixed
:
...
...
@@ -498,6 +504,12 @@ func codegenType(path string, typ types.Type, obj types.Object, codegen CodecCod
}
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
:
// TODO optimize for [...]byte
var
i
int64
// XXX because `u.Len() int64`
...
...
@@ -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
)
}
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
:
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