Package net.sodacan.core.persist.file
Class FilePersister
java.lang.Object
net.sodacan.core.persist.AbstractPersister
net.sodacan.core.persist.file.FilePersister
- All Implemented Interfaces:
Persister
Persist all @Save fields for one actor into a file.
We collect all the fields and then write them together on a commit.
This persister is devoted to a single actorid as are all persisters.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
begin()
If we've already loaded the Actor, no need to do it again.void
commit()
This method is called when the framework has concluded a series of writes that could be rolled back in case of an error.byte[]
This method is called by the framework when an actor's processMessage method is about to be called for the first time after the Actor has been instantiated.void
rollback()
When a series of writes should be rolled back: not written in the first place, replaced with a previous version, etc.void
The save method is called by the framework when an actor's state has been updated.Methods inherited from class net.sodacan.core.persist.AbstractPersister
getActorId, getConfig, makeFile, makeFolder, makeTypeFolder
-
Constructor Details
-
FilePersister
-
-
Method Details
-
begin
public void begin()If we've already loaded the Actor, no need to do it again. Otherwise, load it up. -
commit
public void commit()Description copied from interface:Persister
This method is called when the framework has concluded a series of writes that could be rolled back in case of an error. -
rollback
public void rollback()Description copied from interface:Persister
When a series of writes should be rolled back: not written in the first place, replaced with a previous version, etc. -
write
Description copied from interface:Persister
The save method is called by the framework when an actor's state has been updated. The key provided is unique id within an actor instance. The key can be anything but by convention it is either "actor" meaning all of the scalar attributes of the actor with @Save annotation. For collections, the key is a combination of the @Save name, a dollar sign, and the key used in a map collection. For a set, the key is the unique id of the set entry, the same as used in the equals method for the set. The ActorId was provided during construction of this persister.- Parameters:
key
-bytes
-
-
read
Description copied from interface:Persister
This method is called by the framework when an actor's processMessage method is about to be called for the first time after the Actor has been instantiated.- Parameters:
key
-
-