category: Tutorial
name: Component
attributes:
  identifier:
    field_name: name
    field_type: string
    field_persistence: true
    field_immutable: true
  local_fields:
    - field_name: state
      field_type: string
      field_persistence: true
      field_nullable: true
      field_immutable: false
      field_unique: false
      field_fsm:
        Creating:
          execution_method: create
          success_transition: Active
          failure_transition: Deleting
          status_type: Initial
        Active:
          execution_method: create_confirm
          failure_transition: Deleting
          status_type: Steady
        Deleting:
          execution_method: delete
          success_transition: Deleted
        Deleted:
          execution_method: delete_confirm
          status_type: Terminate
  ref_fields: []
methods:
  class_methods: []
  instance_methods:
    - method_body: |-
        async def create(self, *args, **kwargs):
            print("{}.{}.create()".format(self.__class__.__name__, self.instance))
      propagation_mode: true
      topdown: true
      auto_rollback: true
      multiplexable_number: 1
      field_order: ascend
    - method_body: |-
        async def create_confirm(self, *args, **kwargs):
            for i in range(1, 4):
                print("{}.{} create confirming...{}".format(self.__class__.__name__, self.instance, i))
                await asyncio.sleep(1)
            print("{}.{} create done.".format(self.__class__.__name__, self.instance))
      propagation_mode: true
      topdown: true
      auto_rollback: true
      multiplexable_number: 1
      field_order: ascend
    - method_body: |-
        async def delete(self, *args, **kwargs):
            print("{}.{}.delete()".format(self.__class__.__name__, self.instance))
      propagation_mode: true
      topdown: false
      auto_rollback: true
      multiplexable_number: 1
      field_order: ascend
    - method_body: |-
        async def delete_confirm(self, *args, **kwargs):
            for i in range(1, 4):
                print("{}.{} delete confirming...{}".format(self.__class__.__name__, self.instance, i))
                await asyncio.sleep(1)
            await self.destroy()
      propagation_mode: true
      topdown: false
      auto_rollback: true
      multiplexable_number: 1
      field_order: ascend
persistence: false
abstract: true
api_generation: false