The version currently viewed is the result of machine-translated Chinese Simplified and manual proofreading.If there is any mistranslation in the document, please click here to submit your translation proposal.

Simple to say Claptrap = Actor + Event Sourcing


Claptrap is a special actor defined in this framework.In addition to the underlying characteristics of Actor, Claptrap is defined as having the following characteristics.:

The state is controlled by the event。The state of the Actor is maintained inside the Actor.It is the same for Claptrap, but changing the state of Claptrap, in addition to the Actor, limits it to change only through events.This combines the event sourcing pattern with the Actor pattern.The correctness and traceability of the Actor state are ensured by the event sourcing mode.These events that change the state of Claptrap are generated by Claptrap itself.The event can occur because of an external call or because of a class trigger mechanism inside Claptrap.

Claptrap is a classic character in an old game that newbe36524 has played.Click here to learn more.

The following is a story-based description of Claptrap to aid understanding.Don't care too much.

Claptrap is a simple-to-structure, functional robot.Although it can accomplish a wide variety of tasks, it has some limitations.

Claptrap is a single-threaded robot that can perform only one task at a time.If you want to give it multiple tasks, it will be handled one by one in the order in which things are scheduled.

Claptrap's work is probably like this.When he accepts a task, he will first consider whether he can do it 100 percent.If he can do it 100 percent, then write it into his memo and finish it.Then proceed to the next thing.

The first thing Claptrap does every morning is to find itself.Get back itself as yesterday.First of all, it will try to see if there is yesterday's beautiful picture, if there is, it will re-incarcelate yesterday's appearance.Next, read from the memo in your hand what happened after yesterday's photo shoot, and gradually restore your memory.This will succeed in finding yourself.

Claptrap is a standardized robot.They are all produced on the production line of the Claptrap plant.The factory assembles a Claptrap robot using standardized components based on the Claptrap design.These necessary components mainly include:memory, handheld memos, multifunction task processors and memory printers.

Memory.Claptrap is equipped with a custom-sized memory that holds the state data of the current machine.Because of the volatile power loss of memory data, if Claptrap loses power, the data in memory is lost.

A multifunction task processor.Based on cost considerations, the multifunction task processors equipped with each Clatrapp are custom-made for special tasks.For example:Clatraps dedicated to firefighting, which are essentially contained in their multifunctional task processors, are both firefighting-related functions.But it can't handle domestic-related tasks.

Handheld memo.Claptrap uses a handheld memo to record all the details of the task before doing each task to ensure that every detail of the task is accurate.

Memory printer.The data in memory can be printed into a physical format that can be persisted, and more in real production is the DNA memory.Because of the volatile power loss of memory data, the data in memory after the restart can only be retrieved one by one through memo records.But because memo data is likely to be large, recovery will be slow.With the help of a memory printer, you can fully print out the memory state at some point, which speeds up memory data recovery when you restart recovery.