Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Yoji Takeuchi
erp5
Commits
43a399f3
Commit
43a399f3
authored
May 30, 2012
by
Romain Courteaud
Committed by
Sebastien Robin
Aug 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename file.
parent
b25c0dc8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
product/ERP5Type/BTreeData.py
product/ERP5Type/BTreeData.py
+15
-13
No files found.
product/ERP5Type/
pdata_replacement
.py
→
product/ERP5Type/
BTreeData
.py
View file @
43a399f3
import
transaction
import
transaction
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
from
BTrees.IOBTree
import
IOBTree
from
BTrees.LOBTree
import
LOBTree
from
persistent
import
Persistent
class
PersistentString
(
persistent
.
Persistent
):
class
PersistentString
(
Persistent
):
def
__init__
(
self
,
value
):
def
__init__
(
self
,
value
):
self
.
value
=
value
self
.
value
=
value
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
value
return
self
.
value
class
BTreeData
2
(
persistent
.
Persistent
):
class
BTreeData
(
Persistent
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
tree
=
I
OBTree
()
self
.
tree
=
L
OBTree
()
def
write
(
self
,
buf
,
offset
):
def
write
(
self
,
buf
,
offset
):
# TODO: auto-aggregation of continuous keys when overwriting
# TODO: auto-aggregation of continuous keys when overwriting
offset
=
int
(
offset
)
# offset = long
(offset)
assert
not
isinstance
(
offset
,
long
),
'Offset is too big for int '
\
#
assert not isinstance(offset, long), 'Offset is too big for int ' \
'type: %s'
%
(
offset
,
)
#
'type: %s' % (offset, )
tree
=
self
.
tree
tree
=
self
.
tree
buf_len
=
len
(
buf
)
buf_len
=
len
(
buf
)
try
:
try
:
...
@@ -60,9 +61,10 @@ class BTreeData2(persistent.Persistent):
...
@@ -60,9 +61,10 @@ class BTreeData2(persistent.Persistent):
def
read
(
self
,
offset
,
size
):
def
read
(
self
,
offset
,
size
):
#print 'read', hex(offset), hex(size)
#print 'read', hex(offset), hex(size)
start_offset
=
offset
=
int
(
offset
)
start_offset
=
offset
assert
not
isinstance
(
offset
,
long
),
'Offset is too big for int '
\
# start_offset = offset = int(offset)
'type: %s'
%
(
offset
,
)
# assert not isinstance(offset, long), 'Offset is too big for int ' \
# 'type: %s' % (offset, )
tree
=
self
.
tree
tree
=
self
.
tree
result
=
StringIO
()
result
=
StringIO
()
write
=
result
.
write
write
=
result
.
write
...
@@ -96,9 +98,9 @@ class BTreeData2(persistent.Persistent):
...
@@ -96,9 +98,9 @@ class BTreeData2(persistent.Persistent):
return
result
.
getvalue
()
return
result
.
getvalue
()
def
truncate
(
self
,
offset
):
def
truncate
(
self
,
offset
):
offset
=
int
(
offset
)
#
offset = int(offset)
assert
not
isinstance
(
offset
,
long
),
'Offset is too big for int '
\
#
assert not isinstance(offset, long), 'Offset is too big for int ' \
'type: %s'
%
(
offset
,
)
#
'type: %s' % (offset, )
tree
=
self
.
tree
tree
=
self
.
tree
try
:
try
:
key
=
tree
.
maxKey
(
offset
)
key
=
tree
.
maxKey
(
offset
)
...
...
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