Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
230ffbe8
Commit
230ffbe8
authored
Sep 03, 2000
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send storage info on startup.
Send storage size info to all clients at end of pack and commit.
parent
d9d3aba7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
src/ZEO/StorageServer.py
src/ZEO/StorageServer.py
+22
-6
No files found.
src/ZEO/StorageServer.py
View file @
230ffbe8
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
#
#
##############################################################################
##############################################################################
__version__
=
"$Revision: 1.1
4
$"
[
11
:
-
2
]
__version__
=
"$Revision: 1.1
5
$"
[
11
:
-
2
]
import
asyncore
,
socket
,
string
,
sys
,
cPickle
,
os
import
asyncore
,
socket
,
string
,
sys
,
cPickle
,
os
from
smac
import
SizedMessageAsyncConnection
from
smac
import
SizedMessageAsyncConnection
...
@@ -156,11 +156,13 @@ class StorageServer(asyncore.dispatcher):
...
@@ -156,11 +156,13 @@ class StorageServer(asyncore.dispatcher):
self
.
__connections
[
storage_id
]
=
n
self
.
__connections
[
storage_id
]
=
n
def
invalidate
(
self
,
connection
,
storage_id
,
invalidated
,
def
invalidate
(
self
,
connection
,
storage_id
,
invalidated
=
(),
info
=
0
,
dump
=
dump
):
dump
=
dump
):
for
c
in
self
.
__connections
[
storage_id
]:
for
c
in
self
.
__connections
[
storage_id
]:
if
c
is
connection
:
continue
if
invalidated
and
c
is
not
connection
:
c
.
message_output
(
'I'
+
dump
(
invalidated
,
1
))
c
.
message_output
(
'I'
+
dump
(
invalidated
,
1
))
if
info
:
c
.
message_output
(
'S'
+
dump
(
info
,
1
))
def
writable
(
self
):
return
0
def
writable
(
self
):
return
0
...
@@ -252,8 +254,11 @@ class Connection(SizedMessageAsyncConnection):
...
@@ -252,8 +254,11 @@ class Connection(SizedMessageAsyncConnection):
blather
(
'message_input'
,
m
,
id
(
self
))
blather
(
'message_input'
,
m
,
id
(
self
))
if
self
.
__storage
is
None
:
if
self
.
__storage
is
None
:
# This is the first communication from the client
self
.
__storage
,
self
.
__storage_id
=
(
self
.
__storage
,
self
.
__storage_id
=
(
self
.
__server
.
register_connection
(
self
,
message
))
self
.
__server
.
register_connection
(
self
,
message
))
# Send info back asynchronously, so client need not ask
self
.
message_output
(
'S'
+
dump
(
self
.
get_info
(),
1
))
return
return
rt
=
'R'
rt
=
'R'
...
@@ -308,6 +313,13 @@ class Connection(SizedMessageAsyncConnection):
...
@@ -308,6 +313,13 @@ class Connection(SizedMessageAsyncConnection):
'supportsVersions'
:
storage
.
supportsVersions
(),
'supportsVersions'
:
storage
.
supportsVersions
(),
}
}
def
get_size_info
(
self
):
storage
=
self
.
__storage
return
{
'length'
:
len
(
storage
),
'size'
:
storage
.
getSize
(),
}
def
zeoLoad
(
self
,
oid
):
def
zeoLoad
(
self
,
oid
):
storage
=
self
.
__storage
storage
=
self
.
__storage
v
=
storage
.
modifiedInVersion
(
oid
)
v
=
storage
.
modifiedInVersion
(
oid
)
...
@@ -356,7 +368,10 @@ class Connection(SizedMessageAsyncConnection):
...
@@ -356,7 +368,10 @@ class Connection(SizedMessageAsyncConnection):
def
_pack
(
self
,
t
):
def
_pack
(
self
,
t
):
self
.
__storage
.
pack
(
t
,
referencesf
)
self
.
__storage
.
pack
(
t
,
referencesf
)
self
.
message_output
(
'S'
+
dump
(
self
.
get_info
(),
1
))
# Broadcast new size statistics
self
.
__server
.
invalidate
(
0
,
self
.
__storage_id
,
(),
self
.
get_size_info
())
def
abortVersion
(
self
,
src
,
id
):
def
abortVersion
(
self
,
src
,
id
):
t
=
self
.
_transaction
t
=
self
.
_transaction
...
@@ -507,7 +522,8 @@ class Connection(SizedMessageAsyncConnection):
...
@@ -507,7 +522,8 @@ class Connection(SizedMessageAsyncConnection):
self
.
_transaction
=
None
self
.
_transaction
=
None
if
self
.
__invalidated
:
if
self
.
__invalidated
:
self
.
__server
.
invalidate
(
self
,
self
.
__storage_id
,
self
.
__server
.
invalidate
(
self
,
self
.
__storage_id
,
self
.
__invalidated
)
self
.
__invalidated
,
self
.
get_size_info
())
self
.
__invalidated
=
[]
self
.
__invalidated
=
[]
def
init_storage
(
storage
):
def
init_storage
(
storage
):
...
...
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