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
b54a37a1
Commit
b54a37a1
authored
Sep 08, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
13911ca3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
420 additions
and
0 deletions
+420
-0
t/NOTES
t/NOTES
+336
-0
t/pkt.go
t/pkt.go
+12
-0
t/pktgen.go
t/pktgen.go
+72
-0
No files found.
t/NOTES
0 → 100644
View file @
b54a37a1
Wire proto
----------
# all in network byte-order
PktHeader
.id u32 // autoincrement on ask (?)
.code u16 // defined by seqno if register(...) call in Packets
.length u32 // whole pkt length
# response_code = 0x8000 | code
List
.len u32
[len]items
Dict
.len u32
[len] key, value
Enum
.value s32 // None -> -1
String
.len u32
[len] strdata
Address
.host String
.port u16 // present only if .host != ''
Bool
.value u8
Number
.value u32
Index
.value u64
PTID
.value u64 // 0 <-> None
Protocol
Number // encode <- version, decode -> check version
Checksum
.checksum [20]u8
UUID
.uuid s32 // 0 <-> None
TID
.tid [8]byte // None <-> \xff*8
POID = PTID
~~~~~~~~
NodeList []
type NodeType
address Address
uuid UUID
state NodeState
CellList []
uuid UUID
state CellState
RowList []
offset Number // u32
cell_list CellList
HistoryList []
serial TID
size Number // u32
UUIDList []
uuid UUID
TidList []
tid TID
OidList []
oid OID
~~~~~~~~
Notify
.message String
Error
.code Number
.message String
Ping
ø
_answer = PFEmpty
CloseClient
ø
RequestIdentification
.protocol_version PProtocol
.node_type NodeType
.uuid UUID
.address Address
.name String
TODO
Storage related messages
------------------------
NotifyReady S -> M
Recovery PM -> S S -> PM
LastIDs PM -> S S -> PM
PartitionTable PM -> S S -> PM
NotifyPartitionTable PM -> S, C
PartitionChanges PM -> S, C // subset of NotifyPartitionTable (?)
StartOperation PM -> S
StopOperation PM -> S
UnfinishedTransactions S -> PM PM -> S
LockedTransactions PM -> S S -> PM
FinalTID * -> S , C -> PM (?)
ValidateTransaction PM -> S
NotifyTransactionFinished M -> S
LockInformation PM -> S S -> PM
UnlockInformation PM -> S
StoreObject C -> S
.oid OID
.serial TID // original serial
.data String
.data_serial TID
.tid tid // current txn id
.unlock bool
AnswerStoreObject S -> C
.conflicting bool
.oid OID
.serial TID
GetObject C -> S
.oid
.serial
.tid
AnswerGetObject S -> C
.oid OID
.serial_start TID
.serial_end TID
.data String
.data_serial TID
AbortTransaction C -> S, PM
.tid
StoreTransaction C -> S S -> C
.tid TID
user, description, ext String
oidv []OID
VoteTransaction C -> S S -> C
.tid
TIDList C -> S
first, last Index // u64 [first, last)
partition Number // u32
AnswerTIDList S -> C
tidv []TID
TIDListFrom C -> S
min_tid, max_tid TID
length Number
partition Number
AnswerTIDListFrom S -> C
tidv []TID
TransactionInformation * -> S
tid TID
AnswerTransactionInformation S -> *
tid TID
user, description, extension String
packed bool
oidv []OID
ObjectHistory C -> S
oid OID
first, last Index // [first, last]
AnswerObjectHistory
oid OID
historyv []strict{serial TID; size Number}
ObjectUndoSerial C -> S
tid TID
ltid TID // ?
undone_tid TID // ?
oidv []OID
AnswerObjectUndoSerial S -> C
{} oid ->
.current_serial TID
.undo_serial TID
.is_current bool
HasLock C -> S
tid TID
oid OID
AnswerHasLock S -> C
oid OID
lock_state LockState // not_locket, granted, granted_to_other:w
CheckCurrentSerial C -> S AnswerCheckCurrentSerial S -> C
tid TID conflicting bool
serial TID oid OID
oid OID serial TID
Pack C -> M -> S
tid TID
CheckPartition M -> S
partition Number
upstream_name String
address Address
min_tid, max_tid TID
CheckTIDRange S -> S AnswerCheckTIDRange S -> S
partition Number count Number
length Number checksum Checksum
min_tid, max_tid TID max_tid TID
CheckSerialRange S -> S
ParitionCorrupted S -> M
partition Number
uuidv []UUID
~~~~~~~~
(?)
NotifyNodeIntormation
NodeInformation
TODO
Tables
------
- config
.name str
.value str
(name, nid, partitions, ptid, replicas, version, zodb=pickle...)
- pt
.rid int // = row id = part of oid space
.nid int
.state tinyint // = cell state
pkey (rid, nid)
# committed txns
- trans
.partition smallint
.tid bigint
.packed bool
.oids mediumblob // []oid
.user blob
.description blob
.ext blob
.ttid bigint // XXX ?
pkey (partition, tid)
# committed object metadata
- obj
.partition smallint
.oid bigint
.tid bigint
.data_id bigint | NULL // -> data.id
.value_tid bigint | NULL // XXX ? (у нас NULL)
pkey (partition, tid, oid)
key (partition, oid, tid)
key data_id
# object data
- data
.id bigint
.hash sha1 // UNIQUE (hash, compression)
.compression tinyint
.value mediumblob
key id
key (hash, compression) // <- from UNIQUE ^^^
- (bigdata)
# uncommitted transactions
# (= trans)
- ttrans
.partition smallint
.tid bigint
.packed bool
.oids mediumblob // []oid
.user blob
.description blob
.ext blob
ttid bigint // XXX ?
# uncommitted object metadata
# (= obj)
- tobj
t/pkt.go
0 → 100644
View file @
b54a37a1
package
pkt
type
Header
struct
{
Id
uint32
Code
uint16
Len
uint32
}
type
Notify
struct
{
// Header
Message
string
}
t/pktgen.go
0 → 100644
View file @
b54a37a1
package
main
import
(
"fmt"
"go/ast"
"go/parser"
"go/token"
)
var
_
=
ast
.
Print
func
main
()
{
fset
:=
token
.
NewFileSet
()
var
mode
parser
.
Mode
=
0
// parser.Trace
f
,
err
:=
parser
.
ParseFile
(
fset
,
"pkt.go"
,
nil
,
mode
)
if
err
!=
nil
{
panic
(
err
)
// XXX log
}
ncode
:=
0
//ast.Print(fset, f)
for
_
,
decl
:=
range
f
.
Decls
{
// we look for types (which can be only under GenDecl)
gdecl
,
ok
:=
decl
.
(
*
ast
.
GenDecl
)
if
!
ok
||
gdecl
.
Tok
!=
token
.
TYPE
{
continue
}
for
_
,
spec
:=
range
gdecl
.
Specs
{
tspec
:=
spec
.
(
*
ast
.
TypeSpec
)
// must be because tok = TYPE
tname
:=
tspec
.
Name
.
Name
// we are only interested in struct types
tstruct
,
ok
:=
tspec
.
Type
.
(
*
ast
.
StructType
)
if
!
ok
{
continue
}
/*
fmt.Printf("%s:\n", tname)
fmt.Println(tstruct)
ast.Print(fset, tstruct)
*/
if
ncode
!=
0
{
fmt
.
Println
()
}
for
_
,
fieldv
:=
range
tstruct
.
Fields
.
List
{
// we only support simple types like uint16
ftype
,
ok
:=
fieldv
.
Type
.
(
*
ast
.
Ident
)
if
!
ok
{
// TODO log
// TODO proper error message
panic
(
fmt
.
Sprintf
(
"%#v not supported"
,
fieldv
.
Type
))
}
for
_
,
field
:=
range
fieldv
.
Names
{
fmt
.
Printf
(
"%s(%d).%s
\t
%s
\n
"
,
tname
,
ncode
,
field
.
Name
,
ftype
)
}
}
ncode
++
}
//fmt.Println(gdecl)
//ast.Print(fset, gdecl)
}
}
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