Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ipaaca
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ramin Yaghoubzadeh Torky
ipaaca
Commits
03459cef
Commit
03459cef
authored
8 years ago
by
Ramin Yaghoubzadeh Torky
Browse files
Options
Downloads
Plain Diff
Merged (sry, forgot rebase)
parents
e3337663
662ac3b5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ipaacalib/python/src/ipaaca/buffer.py
+38
-2
38 additions, 2 deletions
ipaacalib/python/src/ipaaca/buffer.py
with
38 additions
and
2 deletions
ipaacalib/python/src/ipaaca/buffer.py
+
38
−
2
View file @
03459cef
...
@@ -49,12 +49,10 @@ import ipaaca.converter
...
@@ -49,12 +49,10 @@ import ipaaca.converter
import
ipaaca.iu
import
ipaaca.iu
__all__
=
[
__all__
=
[
'
InputBuffer
'
,
'
InputBuffer
'
,
'
OutputBuffer
'
,
'
OutputBuffer
'
,
]
]
LOGGER
=
ipaaca
.
misc
.
get_library_logger
()
LOGGER
=
ipaaca
.
misc
.
get_library_logger
()
# set of objects to auto-clean on exit, assumes _teardown() method
# set of objects to auto-clean on exit, assumes _teardown() method
...
@@ -214,6 +212,7 @@ class InputBuffer(Buffer):
...
@@ -214,6 +212,7 @@ class InputBuffer(Buffer):
"""
An InputBuffer that holds remote IUs.
"""
"""
An InputBuffer that holds remote IUs.
"""
@auto_teardown_instances
def
__init__
(
self
,
owning_component_name
,
category_interests
=
None
,
channel
=
None
,
participant_config
=
None
,
resend_active
=
False
):
def
__init__
(
self
,
owning_component_name
,
category_interests
=
None
,
channel
=
None
,
participant_config
=
None
,
resend_active
=
False
):
'''
Create an InputBuffer.
'''
Create an InputBuffer.
...
@@ -276,6 +275,24 @@ class InputBuffer(Buffer):
...
@@ -276,6 +275,24 @@ class InputBuffer(Buffer):
self
.
_category_interests
.
remove
(
iu_category
)
self
.
_category_interests
.
remove
(
iu_category
)
LOGGER
.
info
(
"
Removed listener in scope /ipaaca/channel/
"
+
str
(
self
.
_channel
)
+
"
/category/
"
+
iu_category
)
LOGGER
.
info
(
"
Removed listener in scope /ipaaca/channel/
"
+
str
(
self
.
_channel
)
+
"
/category/
"
+
iu_category
)
def
_teardown
(
self
):
'''
OutputBuffer retracts remaining live IUs on teardown
'''
self
.
_deactivate_all_internal
()
def
__del__
(
self
):
'''
Perform teardown as soon as Buffer is lost.
'''
self
.
_deactivate_all_internal
()
def
_deactivate_all_internal
(
self
):
'''
Deactivate all participants.
'''
for
listener
in
self
.
_listener_store
.
values
():
try
:
listener
.
deactivate
()
except
RuntimeError
:
# Is raised if an already deactivated participant is
# deactivated again
pass
def
_handle_iu_events
(
self
,
event
):
def
_handle_iu_events
(
self
,
event
):
'''
Dispatch incoming IU events.
'''
Dispatch incoming IU events.
...
@@ -428,12 +445,15 @@ class OutputBuffer(Buffer):
...
@@ -428,12 +445,15 @@ class OutputBuffer(Buffer):
def
_teardown
(
self
):
def
_teardown
(
self
):
'''
OutputBuffer retracts remaining live IUs on teardown
'''
'''
OutputBuffer retracts remaining live IUs on teardown
'''
self
.
_retract_all_internal
()
self
.
_retract_all_internal
()
self
.
_deactivate_all_internal
()
def
__del__
(
self
):
def
__del__
(
self
):
'''
Perform teardown (IU retractions) as soon as Buffer is lost.
'''
Perform teardown (IU retractions) as soon as Buffer is lost.
Note that at program exit the teardown might be called
Note that at program exit the teardown might be called
twice for live objects (atexit, then del), but the
twice for live objects (atexit, then del), but the
_retract_all_internal method prevents double retractions.
'''
_retract_all_internal method prevents double retractions.
'''
self
.
_retract_all_internal
()
self
.
_retract_all_internal
()
self
.
_deactivate_all_internal
()
def
_remote_update_links
(
self
,
update
):
def
_remote_update_links
(
self
,
update
):
'''
Apply a remotely requested update to one of the stored IU
'
s links.
'''
'''
Apply a remotely requested update to one of the stored IU
'
s links.
'''
...
@@ -574,6 +594,22 @@ class OutputBuffer(Buffer):
...
@@ -574,6 +594,22 @@ class OutputBuffer(Buffer):
if
not
iu
.
_retracted
:
if
not
iu
.
_retracted
:
self
.
_retract_iu
(
iu
)
self
.
_retract_iu
(
iu
)
def
_deactivate_all_internal
(
self
):
'''
Deactivate all participants.
'''
try
:
self
.
_server
.
deactivate
()
except
RuntimeError
:
# Is raised if an already deactivated participant is
# deactivated again
pass
for
informer
in
self
.
_informer_store
.
values
():
try
:
informer
.
deactivate
()
except
RuntimeError
:
# Is raised if an already deactivated participant is
# deactivated again
pass
def
_send_iu_commission
(
self
,
iu
,
writer_name
):
def
_send_iu_commission
(
self
,
iu
,
writer_name
):
'''
Send IU commission.
'''
Send IU commission.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment