Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
15
Merge Requests
15
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
nexedi
slapos.core
Commits
ad3ac5e2
Commit
ad3ac5e2
authored
Feb 29, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a shared cache to speed up getComputerInformation
parent
ff58e583
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
13 deletions
+133
-13
master/bt5/vifib_erp5/PathTemplateItem/portal_caches/slap_cache_factory.xml
...rp5/PathTemplateItem/portal_caches/slap_cache_factory.xml
+74
-0
master/bt5/vifib_erp5/PathTemplateItem/portal_caches/slap_cache_factory/persistent_cache_plugin.xml
...tal_caches/slap_cache_factory/persistent_cache_plugin.xml
+36
-0
master/bt5/vifib_erp5/bt/revision
master/bt5/vifib_erp5/bt/revision
+1
-1
master/bt5/vifib_erp5/bt/template_path_list
master/bt5/vifib_erp5/bt/template_path_list
+2
-0
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+20
-12
No files found.
master/bt5/vifib_erp5/PathTemplateItem/portal_caches/slap_cache_factory.xml
0 → 100644
View file @
ad3ac5e2
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Cache Factory"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
cache_duration
</string>
</key>
<value>
<int>
200
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slap_cache_factory
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Cache Factory
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Slap Cache Factory
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_erp5/PathTemplateItem/portal_caches/slap_cache_factory/persistent_cache_plugin.xml
0 → 100644
View file @
ad3ac5e2
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Distributed Ram Cache"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
specialise/portal_memcached/persistent_memcached_plugin
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
persistent_cache_plugin
</string>
</value>
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Distributed Ram Cache
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Persistent Distributed Ram Cache
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_erp5/bt/revision
View file @
ad3ac5e2
391
\ No newline at end of file
392
\ No newline at end of file
master/bt5/vifib_erp5/bt/template_path_list
View file @
ad3ac5e2
...
...
@@ -68,6 +68,8 @@ person_module/test_vifib_user_admin
person_module/test_vifib_user_admin/**
person_module/test_vifib_user_developer
person_module/test_vifib_user_developer/**
portal_caches/slap_cache_factory
portal_caches/slap_cache_factory/persistent_cache_plugin
service_module/computer_registration
service_module/computer_registration/**
service_module/vifib_discount
...
...
master/product/Vifib/Tool/SlapTool.py
View file @
ad3ac5e2
...
...
@@ -38,6 +38,7 @@ from Products.ERP5Type.Globals import InitializeClass
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
ComplexQuery
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Cache
import
CachingMethod
from
lxml
import
etree
try
:
from
slapos.slap.slap
import
Computer
...
...
@@ -140,19 +141,26 @@ class SlapTool(BaseTool):
Reuses slap library for easy marshalling.
"""
self
.
REQUEST
.
response
.
setHeader
(
'Content-Type'
,
'text/xml'
)
slap_computer
=
Computer
(
computer_id
)
parent_uid
=
self
.
_getComputerUidByReference
(
computer_id
)
slap_computer
.
_computer_partition_list
=
[]
slap_computer
.
_software_release_list
=
\
self
.
_getSoftwareReleaseValueListForComputer
(
computer_id
)
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
(
parent_uid
=
parent_uid
,
portal_type
=
"Computer Partition"
):
slap_computer
.
_computer_partition_list
.
append
(
self
.
_getSlapPartitionByPackingList
(
computer_partition
.
getObject
()))
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
def
_getComputerInformation
(
computer_id
,
user
):
self
.
REQUEST
.
response
.
setHeader
(
'Content-Type'
,
'text/xml'
)
slap_computer
=
Computer
(
computer_id
)
parent_uid
=
self
.
_getComputerUidByReference
(
computer_id
)
slap_computer
.
_computer_partition_list
=
[]
slap_computer
.
_software_release_list
=
\
self
.
_getSoftwareReleaseValueListForComputer
(
computer_id
)
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
(
parent_uid
=
parent_uid
,
portal_type
=
"Computer Partition"
):
slap_computer
.
_computer_partition_list
.
append
(
self
.
_getSlapPartitionByPackingList
(
computer_partition
.
getObject
()))
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
().
getUserName
()
return
CachingMethod
(
_getComputerInformation
,
id
=
'_getComputerInformation'
,
cache_factory
=
'slap_cache_factory'
)(
computer_id
,
user
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getFullComputerInformation'
)
...
...
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