Created
November 21, 2019 08:59
-
-
Save calaveraInfo/6943ec5fe4c63e5c2bc0ab95e82b5339 to your computer and use it in GitHub Desktop.
Intermittently mutable data concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Index() { | |
/* | |
* @return mutable copy of indexes contained in this instance. | |
*/ | |
MutableIndex beginMutation(); | |
/* | |
* Example usage of indexes for data retrieval. | |
*/ | |
PrimaryKey findBySomeAttributeValue(String value); | |
PrimaryKey findByOtherAttributeValue(String value); | |
/*...*/ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This class is not thread safe, it is intended to exist only | |
* in one thread for a short period of time (equivalent of one transaction). | |
* #endMutation has to be called before sharing data with others. | |
*/ | |
public interface MutableIndex extends Index { | |
/* | |
* @return immutable copy of indexes contained in this instance. | |
*/ | |
Index endMutation(); | |
/* | |
* Example mutable update of contained indexes. | |
*/ | |
void updateSomeIndexes(SomeDomainObject dto); | |
void updateOtherIndexes(OtherDomainObject dto); | |
/*...*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment