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
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):
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
):
def
_readOnly
(
self
,
*
args
,
**
kw
):
raise
NotReadyError
(
'read-only access'
)
...
...
neo/storage/app.py
View file @
9480f2e3
...
...
@@ -251,7 +251,7 @@ class Application(BaseApplication):
while
not
self
.
operational
:
_poll
()
self
.
ready
=
True
self
.
replicator
.
populate
()
# TODO study what's inside
self
.
replicator
.
populate
()
self
.
master_conn
.
notify
(
Packets
.
NotifyReady
())
def
doOperation
(
self
):
...
...
neo/storage/handlers/client.py
View file @
9480f2e3
...
...
@@ -65,15 +65,15 @@ class ClientOperationHandler(EventHandler):
assert
node
is
not
None
,
conn
self
.
app
.
nm
.
remove
(
node
)
def
abortTransaction
(
self
,
conn
,
ttid
):
# NOTE rw
def
abortTransaction
(
self
,
conn
,
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
.
vote
(
ttid
,
txn_info
)
conn
.
answer
(
Packets
.
AnswerStoreTransaction
())
def
askVoteTransaction
(
self
,
conn
,
ttid
):
# NOTE rw
def
askVoteTransaction
(
self
,
conn
,
ttid
):
self
.
app
.
tm
.
vote
(
ttid
)
conn
.
answer
(
Packets
.
AnswerVoteTransaction
())
...
...
@@ -111,7 +111,7 @@ class ClientOperationHandler(EventHandler):
logging
.
info
(
'StoreObject delay: %.02fs'
,
duration
)
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
):
if
1
<
compression
:
raise
ProtocolError
(
'invalid compression value'
)
...
...
@@ -145,10 +145,9 @@ class ClientOperationHandler(EventHandler):
tid_list
=
app
.
dm
.
getTIDList
(
first
,
last
-
first
,
partition_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
)))
# XXX not sure about rw (TODO recheck)
def
askObjectUndoSerial
(
self
,
conn
,
ttid
,
ltid
,
undone_tid
,
oid_list
):
app
=
self
.
app
findUndoTID
=
app
.
dm
.
findUndoTID
...
...
@@ -191,7 +190,6 @@ class ClientOperationHandler(EventHandler):
p
=
Packets
.
AnswerObjectHistory
(
oid
,
history_list
)
conn
.
answer
(
p
)
# XXX should not be rw, but recheck
def
askCheckCurrentSerial
(
self
,
conn
,
ttid
,
serial
,
oid
):
self
.
app
.
tm
.
register
(
conn
,
ttid
)
self
.
_askCheckCurrentSerial
(
conn
,
ttid
,
serial
,
oid
,
time
.
time
())
...
...
@@ -224,3 +222,16 @@ class ClientOperationHandler(EventHandler):
logging
.
info
(
'CheckCurrentSerial delay: %.02fs'
,
duration
)
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):
raise
BrokenNodeDisallowedError
# choose the handler according to the node type
if
node_type
==
NodeTypes
.
CLIENT
:
handler
=
ClientOperationHandler
# NOTE
if
app
.
dm
.
getBackupTID
():
handler
=
ClientROOperationHandler
else
:
handler
=
ClientOperationHandler
if
node
is
None
:
node
=
app
.
nm
.
createClient
(
uuid
=
uuid
)
elif
node
.
isConnected
():
...
...
neo/storage/replicator.py
View file @
9480f2e3
...
...
@@ -72,7 +72,6 @@ class Partition(object):
if
hasattr
(
self
,
x
)),
id
(
self
))
# NOTE
class
Replicator
(
object
):
current_node
=
None
...
...
t/NOTES
View file @
9480f2e3
...
...
@@ -28,13 +28,14 @@ BaseApplication
.pt ? PartitionTable
.checker Checker
.checker Checker
# checks sha1([]tid -- XXX only tid list, not other metadata & data)
.replicator Replicator
.listening_conn ListeningConnection
.master_conn
.master_node
# (queued events are executed at some txn boundaries & locks)
.event_queue deque (key, callable, msg_id, conn, args)
.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