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
9480f2e3
Commit
9480f2e3
authored
Oct 24, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5e0639c1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
12 deletions
+26
-12
neo/master/handlers/client.py
neo/master/handlers/client.py
+1
-1
neo/storage/app.py
neo/storage/app.py
+1
-1
neo/storage/handlers/client.py
neo/storage/handlers/client.py
+18
-7
neo/storage/handlers/identification.py
neo/storage/handlers/identification.py
+4
-1
neo/storage/replicator.py
neo/storage/replicator.py
+0
-1
t/NOTES
t/NOTES
+2
-1
No files found.
neo/master/handlers/client.py
View file @
9480f2e3
...
@@ -119,7 +119,7 @@ class ClientServiceHandler(MasterHandler):
...
@@ -119,7 +119,7 @@ class ClientServiceHandler(MasterHandler):
self
.
app
.
tm
.
abort
(
tid
,
conn
.
getUUID
())
self
.
app
.
tm
.
abort
(
tid
,
conn
.
getUUID
())
# like ClientServiceHandler but read-only
# like ClientServiceHandler but read-only
& only up-to backup_tid
class
ClientROServiceHandler
(
ClientServiceHandler
):
class
ClientROServiceHandler
(
ClientServiceHandler
):
def
_readOnly
(
self
,
*
args
,
**
kw
):
raise
NotReadyError
(
'read-only access'
)
def
_readOnly
(
self
,
*
args
,
**
kw
):
raise
NotReadyError
(
'read-only access'
)
...
...
neo/storage/app.py
View file @
9480f2e3
...
@@ -251,7 +251,7 @@ class Application(BaseApplication):
...
@@ -251,7 +251,7 @@ class Application(BaseApplication):
while
not
self
.
operational
:
while
not
self
.
operational
:
_poll
()
_poll
()
self
.
ready
=
True
self
.
ready
=
True
self
.
replicator
.
populate
()
# TODO study what's inside
self
.
replicator
.
populate
()
self
.
master_conn
.
notify
(
Packets
.
NotifyReady
())
self
.
master_conn
.
notify
(
Packets
.
NotifyReady
())
def
doOperation
(
self
):
def
doOperation
(
self
):
...
...
neo/storage/handlers/client.py
View file @
9480f2e3
...
@@ -65,15 +65,15 @@ class ClientOperationHandler(EventHandler):
...
@@ -65,15 +65,15 @@ class ClientOperationHandler(EventHandler):
assert
node
is
not
None
,
conn
assert
node
is
not
None
,
conn
self
.
app
.
nm
.
remove
(
node
)
self
.
app
.
nm
.
remove
(
node
)
def
abortTransaction
(
self
,
conn
,
ttid
):
# NOTE rw
def
abortTransaction
(
self
,
conn
,
ttid
):
self
.
app
.
tm
.
abort
(
ttid
)
self
.
app
.
tm
.
abort
(
ttid
)
def
askStoreTransaction
(
self
,
conn
,
ttid
,
*
txn_info
):
# NOTE rw
def
askStoreTransaction
(
self
,
conn
,
ttid
,
*
txn_info
):
self
.
app
.
tm
.
register
(
conn
,
ttid
)
self
.
app
.
tm
.
register
(
conn
,
ttid
)
self
.
app
.
tm
.
vote
(
ttid
,
txn_info
)
self
.
app
.
tm
.
vote
(
ttid
,
txn_info
)
conn
.
answer
(
Packets
.
AnswerStoreTransaction
())
conn
.
answer
(
Packets
.
AnswerStoreTransaction
())
def
askVoteTransaction
(
self
,
conn
,
ttid
):
# NOTE rw
def
askVoteTransaction
(
self
,
conn
,
ttid
):
self
.
app
.
tm
.
vote
(
ttid
)
self
.
app
.
tm
.
vote
(
ttid
)
conn
.
answer
(
Packets
.
AnswerVoteTransaction
())
conn
.
answer
(
Packets
.
AnswerVoteTransaction
())
...
@@ -111,7 +111,7 @@ class ClientOperationHandler(EventHandler):
...
@@ -111,7 +111,7 @@ class ClientOperationHandler(EventHandler):
logging
.
info
(
'StoreObject delay: %.02fs'
,
duration
)
logging
.
info
(
'StoreObject delay: %.02fs'
,
duration
)
conn
.
answer
(
Packets
.
AnswerStoreObject
(
0
,
oid
,
serial
))
conn
.
answer
(
Packets
.
AnswerStoreObject
(
0
,
oid
,
serial
))
def
askStoreObject
(
self
,
conn
,
oid
,
serial
,
# NOTE rw
def
askStoreObject
(
self
,
conn
,
oid
,
serial
,
compression
,
checksum
,
data
,
data_serial
,
ttid
,
unlock
):
compression
,
checksum
,
data
,
data_serial
,
ttid
,
unlock
):
if
1
<
compression
:
if
1
<
compression
:
raise
ProtocolError
(
'invalid compression value'
)
raise
ProtocolError
(
'invalid compression value'
)
...
@@ -145,10 +145,9 @@ class ClientOperationHandler(EventHandler):
...
@@ -145,10 +145,9 @@ class ClientOperationHandler(EventHandler):
tid_list
=
app
.
dm
.
getTIDList
(
first
,
last
-
first
,
partition_list
)
tid_list
=
app
.
dm
.
getTIDList
(
first
,
last
-
first
,
partition_list
)
conn
.
answer
(
Packets
.
AnswerTIDs
(
tid_list
))
conn
.
answer
(
Packets
.
AnswerTIDs
(
tid_list
))
def
askFinalTID
(
self
,
conn
,
ttid
):
# NOTE rw
def
askFinalTID
(
self
,
conn
,
ttid
):
conn
.
answer
(
Packets
.
AnswerFinalTID
(
self
.
app
.
tm
.
getFinalTID
(
ttid
)))
conn
.
answer
(
Packets
.
AnswerFinalTID
(
self
.
app
.
tm
.
getFinalTID
(
ttid
)))
# XXX not sure about rw (TODO recheck)
def
askObjectUndoSerial
(
self
,
conn
,
ttid
,
ltid
,
undone_tid
,
oid_list
):
def
askObjectUndoSerial
(
self
,
conn
,
ttid
,
ltid
,
undone_tid
,
oid_list
):
app
=
self
.
app
app
=
self
.
app
findUndoTID
=
app
.
dm
.
findUndoTID
findUndoTID
=
app
.
dm
.
findUndoTID
...
@@ -191,7 +190,6 @@ class ClientOperationHandler(EventHandler):
...
@@ -191,7 +190,6 @@ class ClientOperationHandler(EventHandler):
p
=
Packets
.
AnswerObjectHistory
(
oid
,
history_list
)
p
=
Packets
.
AnswerObjectHistory
(
oid
,
history_list
)
conn
.
answer
(
p
)
conn
.
answer
(
p
)
# XXX should not be rw, but recheck
def
askCheckCurrentSerial
(
self
,
conn
,
ttid
,
serial
,
oid
):
def
askCheckCurrentSerial
(
self
,
conn
,
ttid
,
serial
,
oid
):
self
.
app
.
tm
.
register
(
conn
,
ttid
)
self
.
app
.
tm
.
register
(
conn
,
ttid
)
self
.
_askCheckCurrentSerial
(
conn
,
ttid
,
serial
,
oid
,
time
.
time
())
self
.
_askCheckCurrentSerial
(
conn
,
ttid
,
serial
,
oid
,
time
.
time
())
...
@@ -224,3 +222,16 @@ class ClientOperationHandler(EventHandler):
...
@@ -224,3 +222,16 @@ class ClientOperationHandler(EventHandler):
logging
.
info
(
'CheckCurrentSerial delay: %.02fs'
,
duration
)
logging
.
info
(
'CheckCurrentSerial delay: %.02fs'
,
duration
)
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
0
,
oid
,
serial
))
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
0
,
oid
,
serial
))
# like ClientOperationHandler but read-only & only up-to backup_tid
class
ClientROOperationHandler
(
ClientOperationHandler
):
def
_readOnly
(
self
,
*
args
,
**
kw
):
raise
NotReadyError
(
'read-only access'
)
abortTransaction
=
_readOnly
askStoreTransaction
=
_readOnly
askVoteTransaction
=
_readOnly
askStoreObject
=
_readOnly
askFinalTID
=
_readOnly
# askObjectUndoSerial is used in undo() but itself is read-only query
askCheckCurrentSerial
=
_readOnly
# takes write lock & is only used when going to commit
neo/storage/handlers/identification.py
View file @
9480f2e3
...
@@ -48,7 +48,10 @@ class IdentificationHandler(EventHandler):
...
@@ -48,7 +48,10 @@ class IdentificationHandler(EventHandler):
raise
BrokenNodeDisallowedError
raise
BrokenNodeDisallowedError
# choose the handler according to the node type
# choose the handler according to the node type
if
node_type
==
NodeTypes
.
CLIENT
:
if
node_type
==
NodeTypes
.
CLIENT
:
handler
=
ClientOperationHandler
# NOTE
if
app
.
dm
.
getBackupTID
():
handler
=
ClientROOperationHandler
else
:
handler
=
ClientOperationHandler
if
node
is
None
:
if
node
is
None
:
node
=
app
.
nm
.
createClient
(
uuid
=
uuid
)
node
=
app
.
nm
.
createClient
(
uuid
=
uuid
)
elif
node
.
isConnected
():
elif
node
.
isConnected
():
...
...
neo/storage/replicator.py
View file @
9480f2e3
...
@@ -72,7 +72,6 @@ class Partition(object):
...
@@ -72,7 +72,6 @@ class Partition(object):
if
hasattr
(
self
,
x
)),
if
hasattr
(
self
,
x
)),
id
(
self
))
id
(
self
))
# NOTE
class
Replicator
(
object
):
class
Replicator
(
object
):
current_node
=
None
current_node
=
None
...
...
t/NOTES
View file @
9480f2e3
...
@@ -28,13 +28,14 @@ BaseApplication
...
@@ -28,13 +28,14 @@ BaseApplication
.pt ? PartitionTable
.pt ? PartitionTable
.checker Checker
.checker Checker
# checks sha1([]tid -- XXX only tid list, not other metadata & data)
.replicator Replicator
.replicator Replicator
.listening_conn ListeningConnection
.listening_conn ListeningConnection
.master_conn
.master_conn
.master_node
.master_node
# (queued events are executed at some txn boundaries & locks)
.event_queue deque (key, callable, msg_id, conn, args)
.event_queue deque (key, callable, msg_id, conn, args)
.event_queue_dict {} key -> count(.event_queue, key)
.event_queue_dict {} key -> count(.event_queue, key)
...
...
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