 //
-//  ActiveDocument
-//
-//  The is the central piece of the Document oriented architecture.
+//  BartlebyDocument+Persistency.swift
+//
+//  This extension deals with:
+//      1. data serialization ( collections, metadata)
+//      2. bsfs blocks storages
+//
+//  This is a central piece of the Document Oriented architecture.
 //  We provide a universal implementation with conditionnal compilation
 //
 //  The document stores references to Bartleby's style ManagedCollections.
 //  This allow to use intensively bindings and distributed data automation.
 //  With the mediation of standard Bindings approach with NSArrayControler
 //
-//  We prefer to centralize the complexity of data handling in the document.
-//  Thats why for example we implement projectBindingsArrayController.didSet with an CGD dispatching
-//  We could have set the binding programmatically in the WindowController
-//  But we consider for clarity that the Storyboarded Bindings Settings should be as exhaustive as possible.
 //  And the potential complexity masked.
-//
-//  Generated by flexions
 //
 
 import Foundation

        return (notCrypted:nonCryptedFileName, crypted:cryptedFileName)
    }


    /// Clean procedure usable during maintenance to clean up potential Orphans blocks@
    public func eraseOrphansBlocks()throws->(){
        if let fileWrappers=self._blocksWrapper?.fileWrappers{
            for (k,_) in fileWrappers {
                if !self.blocks.contains(where: { return $0.digest==k }){
                    try removeBlock(with: k)
                     self.log("Erased block with digest \(k)", file: #file, function: #function, line: #line, category: Default.LOG_CATEGORY, decorative: false)
                }
            }
        }
    }
    
    
}

        }
    }

    // MARK: Maintenance

    /// Clean procedure usable during maintenance to clean up potential Orphans blocks@
    public func eraseOrphansBlocks()throws->(){
        if let fileWrappers=self._blocksWrapper?.fileWrappers{
            for (k,_) in fileWrappers {
                if !self.blocks.contains(where: { return $0.digest==k }){
                    try removeBlock(with: k)
                    self.log("Erased block with digest \(k)", file: #file, function: #function, line: #line, category: Default.LOG_CATEGORY, decorative: false)
                }
            }
        }
    }



    // MARK: - Collections

    /**
     Returns the collection file name
