@ Override public Map < String , Set < String > > cleanObsoleteContent ( ) { if ( ! readWrite ) { return Collections . emptyMap ( ) ; } Map < String , Set < String > > cleanedContents = new HashMap <> ( 2 ) ; cleanedContents . put ( MARKED_CONTENT , new HashSet <> ( ) ) ; cleanedContents . put ( DELETED_CONTENT , new HashSet <> ( ) ) ; synchronized ( contentHashReferences ) { for ( ContentReference fsContent : listLocalContents ( ) ) { if ( ! readWrite ) { return Collections . emptyMap ( ) ; } if ( ! contentHashReferences . containsKey ( fsContent . getHexHash ( ) ) ) { //We have no reference to this content if ( markAsObsolete ( fsContent ) ) { cleanedContents . get ( DELETED_CONTENT ) . add ( fsContent . getContentIdentifier ( ) ) ; } else { cleanedContents . get ( MARKED_CONTENT ) . add ( fsContent . getContentIdentifier ( ) ) ; } } else { obsoleteContents . remove ( fsContent . getHexHash ( ) ) ; //Remove existing references from obsoleteContents } } } return cleanedContents ; }
Clean obsolete contents from the content repository . It will first mark contents as obsolete then after some time if these contents are still obsolete they will be removed .