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
Show 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
package
proto
package
proto
// TODO .TID -> .Tid etc ?
import
(
.
"../"
)
const
(
const
(
PROTOCOL_VERSION
=
6
PROTOCOL_VERSION
=
7
MIN_PACKET_SIZE
=
10
// XXX link this to len(pkthead) ?
MIN_PACKET_SIZE
=
10
// XXX link this to len(pkthead) ?
MAX_PACKET_SIZE
=
0x4000000
MAX_PACKET_SIZE
=
0x4000000
...
@@ -24,6 +26,7 @@ const (
...
@@ -24,6 +26,7 @@ const (
REPLICATION_ERROR
REPLICATION_ERROR
CHECKING_ERROR
CHECKING_ERROR
BACKEND_NOT_IMPLEMENTED
BACKEND_NOT_IMPLEMENTED
READ_ONLY_ACCESS
)
)
type
ClusterState
int
type
ClusterState
int
...
@@ -31,7 +34,7 @@ const (
...
@@ -31,7 +34,7 @@ const (
// NOTE cluster states descriptions is in protocol.py
// NOTE cluster states descriptions is in protocol.py
RECOVERING
ClusterState
=
iota
RECOVERING
ClusterState
=
iota
VERIFYING
VERIFYING
RUNNING
CLUSTER_RUNNING
// XXX conflict with NodeState.
RUNNING
STOPPING
STOPPING
STARTING_BACKUP
STARTING_BACKUP
BACKINGUP
BACKINGUP
...
@@ -79,10 +82,22 @@ type UUID int32
...
@@ -79,10 +82,22 @@ type UUID int32
// TODO UUID_NAMESPACES
// TODO UUID_NAMESPACES
// XXX -> NodeInfo (and use []NodeInfo) ?
type
Address
struct
{
type
NodeList
[]
struct
{
Host
string
Port
uint16
// TODO if Host == 0 -> Port not added to wire (see py.PAddress)
}
// A SHA1 hash
type
Checksum
[
20
]
byte
// Partition Table identifier
// Zero value means "invalid id" (<-> None in py.PPTID)
type
PTid
uint64
// XXX move to common place ?
// NOTE original NodeList = []NodeInfo
type
NodeInfo
struct
{
NodeType
NodeType
Address
PAddress
// TODO
Address
UUID
UUID
NodeState
NodeState
}
}
...
@@ -142,10 +157,10 @@ type CloseClient struct {
...
@@ -142,10 +157,10 @@ type CloseClient struct {
// connection. Any -> Any.
// connection. Any -> Any.
type
RequestIdentification
struct
{
type
RequestIdentification
struct
{
Packet
Packet
ProtocolVersion
PProtocol
// TODO
ProtocolVersion
uint32
// TODO py.PProtocol upon decoding checks for != PROTOCOL_VERSION
NodeType
NodeType
// XXX name
NodeType
NodeType
// XXX name
UUID
UUID
UUID
UUID
Address
PAddress
// TODO
Address
Name
string
Name
string
}
}
...
@@ -157,9 +172,9 @@ type AcceptIdentification struct {
...
@@ -157,9 +172,9 @@ type AcceptIdentification struct {
NumPartitions
uint32
// PNumber
NumPartitions
uint32
// PNumber
NumReplicas
uint32
// PNumber
NumReplicas
uint32
// PNumber
YourUUID
UUID
YourUUID
UUID
Primary
P
Address
// TODO
Primary
Address
// TODO
KnownMasterList
[]
struct
{
KnownMasterList
[]
struct
{
Address
PAddress
Address
UUID
UUID
UUID
UUID
}
}
}
}
...
@@ -191,9 +206,9 @@ type Recovery struct {
...
@@ -191,9 +206,9 @@ type Recovery struct {
type
AnswerRecovery
struct
{
type
AnswerRecovery
struct
{
Packet
Packet
PT
ID
PPTID
// TODO
PT
id
BackupTID
T
ID
BackupTID
T
id
TruncateTID
T
ID
TruncateTID
T
id
}
}
// Ask the last OID/TID so that a master can initialize its TransactionManager.
// Ask the last OID/TID so that a master can initialize its TransactionManager.
...
@@ -204,8 +219,8 @@ type LastIDs struct {
...
@@ -204,8 +219,8 @@ type LastIDs struct {
type
AnswerLastIDs
struct
{
type
AnswerLastIDs
struct
{
Packet
Packet
LastOID
O
ID
LastOID
O
id
LastTID
T
ID
LastTID
T
id
}
}
// Ask the full partition table. PM -> S.
// Ask the full partition table. PM -> S.
...
@@ -216,7 +231,7 @@ type PartitionTable struct {
...
@@ -216,7 +231,7 @@ type PartitionTable struct {
type
AnswerPartitionTable
struct
{
type
AnswerPartitionTable
struct
{
Packet
Packet
PT
ID
PPTID
// TODO
PT
id
RowList
RowList
RowList
RowList
}
}
...
@@ -224,16 +239,16 @@ type AnswerPartitionTable struct {
...
@@ -224,16 +239,16 @@ type AnswerPartitionTable struct {
// Send rows in a partition table to update other nodes. PM -> S, C.
// Send rows in a partition table to update other nodes. PM -> S, C.
type
NotifyPartitionTable
struct
{
type
NotifyPartitionTable
struct
{
Packet
Packet
PT
ID
PPTID
// TODO
PT
id
RowList
RowList
RowList
RowList
}
}
// Notify a subset of a partition table. This is used to notify changes.
// Notify a subset of a partition table. This is used to notify changes.
// PM -> S, C.
// PM -> S, C.
type
PartitionChanges
struct
type
PartitionChanges
struct
{
Packet
Packet
PT
ID
PPTID
// TODO
PT
id
CellList
[]
struct
{
CellList
[]
struct
{
// XXX does below correlate with Cell inside top-level CellList ?
// XXX does below correlate with Cell inside top-level CellList ?
Offset
uint32
// PNumber
Offset
uint32
// PNumber
...
@@ -265,9 +280,9 @@ type UnfinishedTransactions struct {
...
@@ -265,9 +280,9 @@ type UnfinishedTransactions struct {
type
AnswerUnfinishedTransactions
struct
{
type
AnswerUnfinishedTransactions
struct
{
Packet
Packet
MaxTID
T
ID
MaxTID
T
id
TidList
[]
struct
{
TidList
[]
struct
{
UnfinishedTID
T
ID
UnfinishedTID
T
id
}
}
}
}
...
@@ -279,25 +294,25 @@ type LockedTransactions struct {
...
@@ -279,25 +294,25 @@ type LockedTransactions struct {
type
AnswerLockedTransactions
struct
{
type
AnswerLockedTransactions
struct
{
Packet
Packet
TidDict
map
[
T
ID
]
TID
// ttid -> tid
TidDict
map
[
T
id
]
Tid
// ttid -> tid
}
}
// Return final tid if ttid has been committed. * -> S. C -> PM.
// Return final tid if ttid has been committed. * -> S. C -> PM.
type
FinalTID
struct
{
type
FinalTID
struct
{
Packet
Packet
TTID
T
ID
TTID
T
id
}
}
type
AnswerFinalTID
struct
{
type
AnswerFinalTID
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
}
}
// Commit a transaction. PM -> S.
// Commit a transaction. PM -> S.
type
ValidateTransaction
struct
{
type
ValidateTransaction
struct
{
Packet
Packet
TTID
T
ID
TTID
T
id
Tid
T
ID
Tid
T
id
}
}
...
@@ -305,62 +320,62 @@ type ValidateTransaction struct {
...
@@ -305,62 +320,62 @@ type ValidateTransaction struct {
// Answer when a transaction begin, give a TID if necessary. PM -> C.
// Answer when a transaction begin, give a TID if necessary. PM -> C.
type
BeginTransaction
struct
{
type
BeginTransaction
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
}
}
type
AnswerBeginTransaction
struct
{
type
AnswerBeginTransaction
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
}
}
// Finish a transaction. C -> PM.
// Finish a transaction. C -> PM.
// Answer when a transaction is finished. PM -> C.
// Answer when a transaction is finished. PM -> C.
type
FinishTransaction
struct
{
type
FinishTransaction
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
OIDList
[]
O
ID
OIDList
[]
O
id
CheckedList
[]
O
ID
CheckedList
[]
O
id
}
}
type
AnswerFinishTransaction
struct
{
type
AnswerFinishTransaction
struct
{
Packet
Packet
TTID
T
ID
TTID
T
id
T
ID
TID
T
id
Tid
}
}
// Notify that a transaction blocking a replication is now finished
// Notify that a transaction blocking a replication is now finished
// M -> S
// M -> S
type
NotifyTransactionFinished
struct
{
type
NotifyTransactionFinished
struct
{
Packet
Packet
TTID
T
ID
TTID
T
id
MaxTID
T
ID
MaxTID
T
id
}
}
// Lock information on a transaction. PM -> S.
// Lock information on a transaction. PM -> S.
// Notify information on a transaction locked. S -> PM.
// Notify information on a transaction locked. S -> PM.
type
LockInformation
struct
{
type
LockInformation
struct
{
Packet
Packet
Ttid
T
ID
Ttid
T
id
Tid
T
ID
Tid
T
id
}
}
// XXX AnswerInformationLocked ?
// XXX AnswerInformationLocked ?
type
AnswerLockInformation
struct
{
type
AnswerLockInformation
struct
{
Ttid
T
ID
Ttid
T
id
}
}
// Invalidate objects. PM -> C.
// Invalidate objects. PM -> C.
// XXX ask_finish_transaction ?
// XXX ask_finish_transaction ?
type
InvalidateObjects
struct
{
type
InvalidateObjects
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
OidList
[]
O
ID
OidList
[]
O
id
}
}
// Unlock information on a transaction. PM -> S.
// Unlock information on a transaction. PM -> S.
type
UnlockInformation
struct
{
type
UnlockInformation
struct
{
Packet
Packet
TTID
T
ID
TTID
T
id
}
}
// Ask new object IDs. C -> PM.
// Ask new object IDs. C -> PM.
...
@@ -373,7 +388,7 @@ type GenerateOIDs struct {
...
@@ -373,7 +388,7 @@ type GenerateOIDs struct {
// XXX answer_new_oids ?
// XXX answer_new_oids ?
type
AnswerGenerateOIDs
struct
{
type
AnswerGenerateOIDs
struct
{
Packet
Packet
OidList
[]
O
ID
OidList
[]
O
id
}
}
...
@@ -385,38 +400,38 @@ type AnswerGenerateOIDs struct {
...
@@ -385,38 +400,38 @@ type AnswerGenerateOIDs struct {
// node must not try to resolve the conflict. S -> C.
// node must not try to resolve the conflict. S -> C.
type
StoreObject
struct
{
type
StoreObject
struct
{
Packet
Packet
O
ID
OID
O
id
Oid
Serial
T
ID
Serial
T
id
Compression
bool
Compression
bool
Checksum
PChecksum
// TODO
Checksum
Checksum
Data
[]
byte
// XXX or string ?
Data
[]
byte
// XXX or string ?
DataSerial
T
ID
DataSerial
T
id
T
ID
TID
T
id
Tid
Unlock
bool
Unlock
bool
}
}
type
AnswerStoreObject
struct
{
type
AnswerStoreObject
struct
{
Packet
Packet
Conflicting
bool
Conflicting
bool
O
ID
OID
O
id
Oid
Serial
T
ID
Serial
T
id
}
}
// Abort a transaction. C -> S, PM.
// Abort a transaction. C -> S, PM.
type
AbortTransaction
struct
{
type
AbortTransaction
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
}
}
// Ask to store a transaction. C -> S.
// Ask to store a transaction. C -> S.
// Answer if transaction has been stored. S -> C.
// Answer if transaction has been stored. S -> C.
type
StoreTransaction
struct
{
type
StoreTransaction
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
User
string
User
string
Description
string
Description
string
Extension
string
Extension
string
OidList
[]
O
ID
OidList
[]
O
id
// TODO _answer = PFEmpty
// TODO _answer = PFEmpty
}
}
...
@@ -424,7 +439,7 @@ type StoreTransaction struct {
...
@@ -424,7 +439,7 @@ type StoreTransaction struct {
// Answer if transaction has been stored. S -> C.
// Answer if transaction has been stored. S -> C.
type
VoteTransaction
struct
{
type
VoteTransaction
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
// TODO _answer = PFEmpty
// TODO _answer = PFEmpty
}
}
...
@@ -434,21 +449,21 @@ type VoteTransaction struct {
...
@@ -434,21 +449,21 @@ type VoteTransaction struct {
// Answer the requested object. S -> C.
// Answer the requested object. S -> C.
type
GetObject
struct
{
type
GetObject
struct
{
Packet
Packet
O
ID
OID
O
id
Oid
Serial
T
ID
Serial
T
id
T
ID
TID
T
id
Tid
}
}
// XXX answer_object ?
// XXX answer_object ?
type
AnswerGetObject
struct
{
type
AnswerGetObject
struct
{
Packet
Packet
O
ID
OID
O
id
Oid
SerialStart
T
ID
SerialStart
T
id
SerialEnd
T
ID
SerialEnd
T
id
Compression
bool
Compression
bool
Checksum
P
Checksum
Checksum
Checksum
Data
[]
byte
// XXX or string ?
Data
[]
byte
// XXX or string ?
DataSerial
T
ID
DataSerial
T
id
}
}
// Ask for TIDs between a range of offsets. The order of TIDs is descending,
// Ask for TIDs between a range of offsets. The order of TIDs is descending,
...
@@ -456,7 +471,7 @@ type AnswerGetObject struct {
...
@@ -456,7 +471,7 @@ type AnswerGetObject struct {
// Answer the requested TIDs. S -> C.
// Answer the requested TIDs. S -> C.
type
TIDList
struct
{
type
TIDList
struct
{
Packet
Packet
Fi
srt
uint64
// PIndex XXX this is TID actually ?
Fi
rst
uint64
// PIndex XXX this is TID actually ? -> no it is offset in list
Last
uint64
// PIndex ----//----
Last
uint64
// PIndex ----//----
Partition
uint32
// PNumber
Partition
uint32
// PNumber
}
}
...
@@ -464,7 +479,7 @@ type TIDList struct {
...
@@ -464,7 +479,7 @@ type TIDList struct {
// XXX answer_tids ?
// XXX answer_tids ?
type
AnswerTIDList
struct
{
type
AnswerTIDList
struct
{
Packet
Packet
TIDList
[]
T
ID
TIDList
[]
T
id
}
}
// Ask for length TIDs starting at min_tid. The order of TIDs is ascending.
// Ask for length TIDs starting at min_tid. The order of TIDs is ascending.
...
@@ -472,8 +487,8 @@ type AnswerTIDList struct {
...
@@ -472,8 +487,8 @@ type AnswerTIDList struct {
// Answer the requested TIDs. S -> C
// Answer the requested TIDs. S -> C
type
TIDListFrom
struct
{
type
TIDListFrom
struct
{
Packet
Packet
MinTID
T
ID
MinTID
T
id
MaxTID
T
ID
MaxTID
T
id
Length
uint32
// PNumber
Length
uint32
// PNumber
Partition
uint32
// PNumber
Partition
uint32
// PNumber
}
}
...
@@ -481,24 +496,24 @@ type TIDListFrom struct {
...
@@ -481,24 +496,24 @@ type TIDListFrom struct {
// XXX answer_tids ?
// XXX answer_tids ?
type
AnswerTIDListFrom
struct
{
type
AnswerTIDListFrom
struct
{
Packet
Packet
TidList
[]
T
ID
TidList
[]
T
id
}
}
// Ask information about a transaction. Any -> S.
// Ask information about a transaction. Any -> S.
// Answer information (user, description) about a transaction. S -> Any.
// Answer information (user, description) about a transaction. S -> Any.
type
TransactionInformation
struct
{
type
TransactionInformation
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
}
}
type
AnswerTransactionInformation
struct
{
type
AnswerTransactionInformation
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
User
string
User
string
Description
string
Description
string
Extension
string
Extension
string
Packed
bool
Packed
bool
OidList
[]
O
ID
OidList
[]
O
id
}
}
// Ask history information for a given object. The order of serials is
// Ask history information for a given object. The order of serials is
...
@@ -506,16 +521,16 @@ type AnswerTransactionInformation struct {
...
@@ -506,16 +521,16 @@ type AnswerTransactionInformation struct {
// Answer history information (serial, size) for an object. S -> C.
// Answer history information (serial, size) for an object. S -> C.
type
ObjectHistory
struct
{
type
ObjectHistory
struct
{
Packet
Packet
O
ID
OID
O
id
Oid
First
uint64
// PIndex XXX this is actually TID
First
uint64
// PIndex XXX this is actually TID
Last
uint64
// PIndex ----//----
Last
uint64
// PIndex ----//----
}
}
type
AnswerObjectHistory
struct
{
type
AnswerObjectHistory
struct
{
Packet
Packet
O
ID
OID
O
id
Oid
HistoryList
[]
struct
{
HistoryList
[]
struct
{
Serial
T
ID
Serial
T
id
Size
uint32
// PNumber
Size
uint32
// PNumber
}
}
}
}
...
@@ -532,20 +547,20 @@ type PartitionList struct {
...
@@ -532,20 +547,20 @@ type PartitionList struct {
type
AnswerPartitionList
struct
{
type
AnswerPartitionList
struct
{
Packet
Packet
PT
ID
PTID
PT
id
RowList
RowList
RowList
RowList
)
}
// Ask information about nodes
// Ask information about nodes
// Answer information about nodes
// Answer information about nodes
type
NodeList
struct
{
type
X_
NodeList
struct
{
Packet
Packet
NodeType
NodeType
}
}
type
AnswerNodeList
struct
{
type
AnswerNodeList
struct
{
Packet
Packet
NodeList
NodeList
[]
NodeInfo
}
}
// Set the node state
// Set the node state
...
@@ -576,7 +591,7 @@ type TweakPartitionTable struct {
...
@@ -576,7 +591,7 @@ type TweakPartitionTable struct {
// Notify information about one or more nodes. PM -> Any.
// Notify information about one or more nodes. PM -> Any.
type
NotifyNodeInformation
struct
{
type
NotifyNodeInformation
struct
{
Packet
Packet
NodeList
NodeList
[]
NodeInfo
}
}
// Ask node information
// Ask node information
...
@@ -601,7 +616,7 @@ type ClusterInformation struct {
...
@@ -601,7 +616,7 @@ type ClusterInformation struct {
// Ask state of the cluster
// Ask state of the cluster
// Answer state of the cluster
// Answer state of the cluster
type
ClusterState
struct
{
type
X_ClusterState
struct
{
// XXX conflicts with ClusterState enum
Packet
Packet
State
ClusterState
State
ClusterState
}
}
...
@@ -623,18 +638,18 @@ type ClusterState struct {
...
@@ -623,18 +638,18 @@ type ClusterState struct {
// S -> C
// S -> C
type
ObjectUndoSerial
struct
{
type
ObjectUndoSerial
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
LTID
T
ID
LTID
T
id
UndoneTID
T
ID
UndoneTID
T
id
OidList
[]
O
ID
OidList
[]
O
id
}
}
// XXX answer_undo_transaction ?
// XXX answer_undo_transaction ?
type
AnswerObjectUndoSerial
struct
{
type
AnswerObjectUndoSerial
struct
{
Packet
Packet
ObjectTIDDict
map
[
O
ID
]
struct
{
ObjectTIDDict
map
[
O
id
]
struct
{
CurrentSerial
T
ID
CurrentSerial
T
id
UndoSerial
T
ID
UndoSerial
T
id
IsCurrent
bool
IsCurrent
bool
}
}
}
}
...
@@ -644,13 +659,13 @@ type AnswerObjectUndoSerial struct {
...
@@ -644,13 +659,13 @@ type AnswerObjectUndoSerial struct {
// Answer whether a transaction holds the write lock for requested object.
// Answer whether a transaction holds the write lock for requested object.
type
HasLock
struct
{
type
HasLock
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
O
ID
OID
O
id
Oid
}
}
type
AnswerHasLock
struct
{
type
AnswerHasLock
struct
{
Packet
Packet
O
ID
OID
O
id
Oid
LockState
LockState
LockState
LockState
}
}
...
@@ -663,16 +678,16 @@ type AnswerHasLock struct {
...
@@ -663,16 +678,16 @@ type AnswerHasLock struct {
// is nothing to invalidate in any client's cache.
// is nothing to invalidate in any client's cache.
type
CheckCurrentSerial
struct
{
type
CheckCurrentSerial
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
Serial
T
ID
Serial
T
id
O
ID
OID
O
id
Oid
}
}
// XXX answer_store_object ?
// XXX answer_store_object ?
type
AnswerCheckCurrentSerial
struct
{
type
AnswerCheckCurrentSerial
struct
{
Conflicting
bool
Conflicting
bool
O
ID
OID
O
id
Oid
Serial
T
ID
Serial
T
id
}
}
// Request a pack at given TID.
// Request a pack at given TID.
...
@@ -683,7 +698,7 @@ type AnswerCheckCurrentSerial struct {
...
@@ -683,7 +698,7 @@ type AnswerCheckCurrentSerial struct {
// M -> C
// M -> C
type
Pack
struct
{
type
Pack
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
}
}
type
AnswerPack
struct
{
type
AnswerPack
struct
{
...
@@ -697,8 +712,8 @@ type AnswerPack struct {
...
@@ -697,8 +712,8 @@ type AnswerPack struct {
type
CheckReplicas
struct
{
type
CheckReplicas
struct
{
Packet
Packet
PartitionDict
map
[
uint32
/*PNumber*/
]
UUID
// partition -> source
PartitionDict
map
[
uint32
/*PNumber*/
]
UUID
// partition -> source
MinTID
T
ID
MinTID
T
id
MaxTID
T
ID
MaxTID
T
id
// XXX _answer = Error
// XXX _answer = Error
}
}
...
@@ -709,10 +724,10 @@ type CheckPartition struct {
...
@@ -709,10 +724,10 @@ type CheckPartition struct {
Partition
uint32
// PNumber
Partition
uint32
// PNumber
Source
struct
{
Source
struct
{
UpstreamName
string
UpstreamName
string
Address
P
Address
Address
Address
}
}
MinTID
T
ID
MinTID
T
id
MaxTID
T
ID
MaxTID
T
id
}
}
...
@@ -728,15 +743,15 @@ type CheckTIDRange struct {
...
@@ -728,15 +743,15 @@ type CheckTIDRange struct {
Packet
Packet
Partition
uint32
// PNumber
Partition
uint32
// PNumber
Length
uint32
// PNumber
Length
uint32
// PNumber
MinTID
T
ID
MinTID
T
id
MaxTID
T
ID
MaxTID
T
id
}
}
type
AnswerCheckTIDRange
struct
{
type
AnswerCheckTIDRange
struct
{
Packet
Packet
Count
uint32
// PNumber
Count
uint32
// PNumber
Checksum
PChecksum
// TODO
Checksum
Checksum
MaxTID
T
ID
MaxTID
T
id
}
}
// Ask some stats about a range of object history.
// Ask some stats about a range of object history.
...
@@ -751,17 +766,17 @@ type CheckSerialRange struct {
...
@@ -751,17 +766,17 @@ type CheckSerialRange struct {
Packet
Packet
Partition
uint32
// PNumber
Partition
uint32
// PNumber
Length
uint32
// PNumber
Length
uint32
// PNumber
MinTID
T
ID
MinTID
T
id
MaxTID
T
ID
MaxTID
T
id
MinOID
O
ID
MinOID
O
id
}
}
type
AnswerCheckSerialRange
struct
{
type
AnswerCheckSerialRange
struct
{
Count
uint32
// PNumber
Count
uint32
// PNumber
TidChecksum
P
Checksum
TidChecksum
Checksum
MaxTID
T
ID
MaxTID
T
id
OidChecksum
P
Checksum
OidChecksum
Checksum
MaxOID
O
ID
MaxOID
O
id
}
}
// S -> M
// S -> M
...
@@ -782,7 +797,7 @@ type LastTransaction struct {
...
@@ -782,7 +797,7 @@ type LastTransaction struct {
type
AnswerLastTransaction
struct
{
type
AnswerLastTransaction
struct
{
Packet
Packet
T
ID
TID
T
id
Tid
}
}
...
...
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