final DataRecordIdentifier referencingDataRecordIdentifier,
final DataRecordIdentifier referencedDataRecordIdentifier,
final int count) throws GarbageException,
ReferenceLinkGarbageException {
final ReferenceLink referenceLink = linkRecordManager
.searchByReferenced(referencedDataRecordIdentifier);
/*
* to store resulting link count between referencing and referenced
* after update
*/
final int updatedCount;
if (referenceLink == null) {
/* not found */
assertNotRemoveLink(referencingDataRecordIdentifier,
referencedDataRecordIdentifier, count);
/* record creation */
final ReferenceLink newReferenceLink = new ReferenceLink(
referencedDataRecordIdentifier);
updatedCount = newReferenceLink.updateLinkCount(
referencingDataRecordIdentifier, count);
linkRecordManager.appendNewReferenceLink(newReferenceLink);
/* link added => can not be a garbage candidate */
garbageManager
.removeFromCandidateAndOrFromToGarbage(referencedDataRecordIdentifier);