snapshot.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2014-2016 OpenMarket Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. class EventContext(object):
  16. __slots__ = [
  17. "current_state_ids",
  18. "prev_state_ids",
  19. "state_group",
  20. "rejected",
  21. "push_actions",
  22. "prev_group",
  23. "delta_ids",
  24. "prev_state_events",
  25. ]
  26. def __init__(self):
  27. # The current state including the current event
  28. self.current_state_ids = None
  29. # The current state excluding the current event
  30. self.prev_state_ids = None
  31. self.state_group = None
  32. self.rejected = False
  33. self.push_actions = []
  34. # A previously persisted state group and a delta between that
  35. # and this state.
  36. self.prev_group = None
  37. self.delta_ids = None
  38. self.prev_state_events = None