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
8c736e77
Commit
8c736e77
authored
Nov 23, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fa68b9e4
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
146 additions
and
122 deletions
+146
-122
t/neo/cmd/neostorage-go/neostorage.go
t/neo/cmd/neostorage-go/neostorage.go
+1
-1
t/neo/proto/pkt.go
t/neo/proto/pkt.go
+126
-111
t/neo/storage/filestorage.go
t/neo/storage/filestorage.go
+16
-10
t/neo/zodb.go
t/neo/zodb.go
+3
-0
No files found.
t/neo/cmd/neostorage-go/neostorage.go
View file @
8c736e77
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
package
main
package
main
import
(
import
(
"../../storage"
// XXX rel ok?
_
"../../storage"
// XXX rel ok?
)
)
...
...
t/neo/proto/pkt.go
View file @
8c736e77
This diff is collapsed.
Click to expand it.
t/neo/storage/filestorage.go
View file @
8c736e77
...
@@ -3,8 +3,13 @@
...
@@ -3,8 +3,13 @@
// filestorage support XXX text
// filestorage support XXX text
package
storage
package
storage
import
(
"os"
.
"../"
)
type
FileStorage
struct
{
type
FileStorage
struct
{
f
d
int
f
*
os
.
File
// XXX naming -> file ?
}
}
// IStorage
// IStorage
...
@@ -36,32 +41,32 @@ type DataRec struct {
...
@@ -36,32 +41,32 @@ type DataRec struct {
}
}
func
(
TxnRecHead
*
rh
)
MarshalFS
()
[]
byte
{
func
(
rh
*
TxnRecHead
)
MarshalFS
()
[]
byte
{
panic
(
"TODO"
)
panic
(
"TODO"
)
}
}
func
(
TxnRecHead
*
rh
)
UnmarshalFS
(
data
[]
byte
)
{
func
(
rh
*
TxnRecHead
)
UnmarshalFS
(
data
[]
byte
)
{
TODO
//
TODO
}
}
func
NewFileStorage
(
path
string
)
(
*
FileStorage
,
error
)
{
func
NewFileStorage
(
path
string
)
(
*
FileStorage
,
error
)
{
f
d
,
err
:=
...
Open
(
path
,
O_RDONLY
)
f
,
err
:=
os
.
Open
(
path
)
// note opens in O_RDONLY
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
// TODO read file header
// TODO read file header
Read
(
fd
,
4
)
!=
"FS21"
->
invalid
header
//Read(f
, 4) != "FS21" -> invalid header
return
&
FileStorage
{
f
d
:
fd
}
return
&
FileStorage
{
f
:
f
},
nil
}
}
func
(
f
*
FileStorage
)
Close
()
error
{
func
(
f
*
FileStorage
)
Close
()
error
{
err
:=
Os
.
Close
(
f
.
fd
)
err
:=
f
.
f
.
Close
(
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
f
.
f
d
=
-
1
f
.
f
=
nil
return
nil
return
nil
}
}
...
@@ -70,5 +75,6 @@ func (f *FileStorage) Iterate(start, stop Tid) IStorageIterator {
...
@@ -70,5 +75,6 @@ func (f *FileStorage) Iterate(start, stop Tid) IStorageIterator {
panic
(
"TODO start/stop support"
)
panic
(
"TODO start/stop support"
)
}
}
// TODO
return
nil
}
}
t/neo/zodb.go
View file @
8c736e77
...
@@ -18,10 +18,13 @@ const (
...
@@ -18,10 +18,13 @@ const (
INVALID_TID
Tid
=
1
<<
64
-
1
// 0xffffffffffffffff TODO recheck it is the same
INVALID_TID
Tid
=
1
<<
64
-
1
// 0xffffffffffffffff TODO recheck it is the same
INVALID_OID
Oid
=
0xffffffffffffffff
// 1<<64 - 1
INVALID_OID
Oid
=
0xffffffffffffffff
// 1<<64 - 1
ZERO_TID
Tid
=
0
// XXX or simply TID{} ? // XXX -> TID0 ?
ZERO_TID
Tid
=
0
// XXX or simply TID{} ? // XXX -> TID0 ?
TID0
Tid
=
ZERO_TID
// XXX ^^^ choose 1
ZERO_OID
Oid
=
0
// XXX or simply OID{} ? // XXX -> OID0
ZERO_OID
Oid
=
0
// XXX or simply OID{} ? // XXX -> OID0
// OID_LEN = 8
// OID_LEN = 8
// TID_LEN = 8
// TID_LEN = 8
MAX_TID
Tid
=
0x7fffffffffffffff
// SQLite does not accept numbers above 2^63-1 // XXX -> TIDMAX ?
MAX_TID
Tid
=
0x7fffffffffffffff
// SQLite does not accept numbers above 2^63-1 // XXX -> TIDMAX ?
TIDMAX
Tid
=
MAX_TID
// XXX ^^^ choose 1
)
)
...
...
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