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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
8ee6db09
Commit
8ee6db09
authored
Apr 05, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7619a147
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
17 deletions
+5
-17
t/neo/protogen.go
t/neo/protogen.go
+1
-1
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+4
-16
No files found.
t/neo/protogen.go
View file @
8ee6db09
...
...
@@ -885,7 +885,7 @@ func (e *encoder) genMap(path string, typ *types.Map, obj types.Object) {
// output keys in sorted order on the wire
// (easier for debugging & deterministic for testing)
e
.
emit
(
"keyv := make([]%s, 0, l)"
,
typeName
(
typ
.
Key
()))
e
.
emit
(
"keyv := make([]%s, 0, l)"
,
typeName
(
typ
.
Key
()))
// FIXME do not throw old slice away -> do xslice.Realloc()
e
.
emit
(
"for key := range %s {"
,
path
)
e
.
emit
(
" keyv = append(keyv, key)"
)
e
.
emit
(
"}"
)
...
...
t/neo/storage/fs1/filestorage.go
View file @
8ee6db09
...
...
@@ -23,7 +23,7 @@ import (
"os"
"../../zodb"
"../../xcommon/x
math
"
"../../xcommon/x
slice
"
)
// FileStorage is a ZODB storage which stores data in simple append-only file
...
...
@@ -193,11 +193,7 @@ func (txnh *TxnHeader) DataLen() int64 {
func
(
txnh
*
TxnHeader
)
CloneFrom
(
txnh2
*
TxnHeader
)
{
workMem
:=
txnh
.
workMem
lwork2
:=
len
(
txnh2
.
workMem
)
if
cap
(
workMem
)
<
lwork2
{
workMem
=
make
([]
byte
,
lwork2
)
}
else
{
workMem
=
workMem
[
:
lwork2
]
}
workMem
=
xslice
.
Realloc
(
workMem
,
lwork2
)
*
txnh
=
*
txnh2
// now unshare slices
txnh
.
workMem
=
workMem
...
...
@@ -314,11 +310,7 @@ func (txnh *TxnHeader) Load(r io.ReaderAt /* *os.File */, pos int64, flags TxnLo
}
// NOTE we encode whole strings length into len(.workMem)
if
cap
(
txnh
.
workMem
)
<
lstr
{
txnh
.
workMem
=
make
([]
byte
,
lstr
,
xmath
.
CeilPow2
(
uint64
(
lstr
)))
}
else
{
txnh
.
workMem
=
txnh
.
workMem
[
:
lstr
]
}
txnh
.
workMem
=
xslice
.
Realloc
(
txnh
.
workMem
,
lstr
)
// NOTE we encode each x string length into cap(x)
// and set len(x) = 0 to indicate x is not loaded yet
...
...
@@ -653,11 +645,7 @@ func (dh *DataHeader) LoadData(r io.ReaderAt /* *os.File */, buf *[]byte) error
}
// now read actual data
if
int64
(
cap
(
*
buf
))
<
dh
.
DataLen
{
*
buf
=
make
([]
byte
,
dh
.
DataLen
,
xmath
.
CeilPow2
(
uint64
(
dh
.
DataLen
)))
}
else
{
*
buf
=
(
*
buf
)[
:
dh
.
DataLen
]
}
*
buf
=
xslice
.
Realloc64
(
*
buf
,
dh
.
DataLen
)
_
,
err
:=
r
.
ReadAt
(
*
buf
,
dh
.
Pos
+
DataHeaderSize
)
if
err
!=
nil
{
return
dh
.
err
(
"read data"
,
noEOF
(
err
))
// XXX recheck
...
...
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