class DataStore implements DataCacheProvider, RolesProvider {

    int processLocalDomains(List<String> localDomainList) {

        /* we can't have a lastModTime set if we have no local
         * domains - in this case we're going to reset */
        
        if (localDomainList.isEmpty()) {
            return -1;
        }
        
        /* first we need to retrieve the list of domains from ZMS so we
         * know what domains have been deleted already (if any).
         * If we get no response from ZMS, we're not going to stop
         * ZTS from coming up with its local files */
        
        Set<String> zmsDomainList = changeLogStore.getServerDomainList();

        int badDomains = 0;
        for (String domainName : localDomainList) {
            
            /* make sure this domain is still active in ZMS otherwise
             * we'll just remove our local copy. if we were not able
             * to fetch the domain list from ZMS at this time, we'll
             * just defer the cleanup at the next check */

            if (zmsDomainList != null && !zmsDomainList.contains(domainName)) {
                
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Removing local domain: {}. Domain not in ZMS anymore.", domainName);
                }
                
                deleteDomain(domainName);
                continue;
            }
            
            /* if we get a failure when processing a local domain then it
             * indicates that we had an invalid domain file (possibly
             * corrupted or hacked. In this case we're going to drop
             * everything and request a full refresh from ZMS only if the
             * change log store supports that functionality. Otherwise,
             * we're going to just skip the domain and continue. */

            if (!processLocalDomain(domainName)) {
                if (changeLogStore.supportsFullRefresh()) {
                    return -1;
                } else {
                    badDomains += 1;
                }
            }
        }

        /* if more than 1/4 of our domains are bad then we have some
         * issue that needs to be addressed so we're going to return failure */

        if (badDomains > localDomainList.size() / 4) {
            LOGGER.error("Too many invalid domains: {} out of {}", badDomains, localDomainList.size());
            return -1;
        }

        return badDomains;
    }

    public  DataStore(ChangeLogStore clogStore, CloudStore cloudStore);

}