Search in sources :

Example 1 with TimeAndVersionRetentionState

use of com.ms.silverking.cloud.dht.TimeAndVersionRetentionState in project SilverKing by Morgan-Stanley.

the class DirectoryInMemorySS method reap.

private void reap() {
    if (serializedVersions.size() > reapMinVersions) {
        ValueRetentionPolicy vrp;
        Set<Long> versionsToRemove;
        Log.warningf("Reap DirectoryInMemorySS %s", KeyUtil.keyToString(dirKey));
        versionsToRemove = new HashSet<>();
        vrp = nsOptions.getValueRetentionPolicy();
        if (vrp instanceof TimeAndVersionRetentionPolicy) {
            TimeAndVersionRetentionState rs;
            long curTimeNanos;
            rs = new TimeAndVersionRetentionState();
            curTimeNanos = SystemTimeSource.instance.absTimeNanos();
            for (long version : serializedVersions.descendingKeySet()) {
                if (!vrp.retains(dirKey, version, curTimeNanos, false, rs, curTimeNanos)) {
                    versionsToRemove.add(version);
                }
            }
        } else {
            Log.warning("Unexpected retention policy: " + vrp);
        }
        remove(versionsToRemove);
    }
}
Also used : TimeAndVersionRetentionState(com.ms.silverking.cloud.dht.TimeAndVersionRetentionState) ValueRetentionPolicy(com.ms.silverking.cloud.dht.ValueRetentionPolicy) TimeAndVersionRetentionPolicy(com.ms.silverking.cloud.dht.TimeAndVersionRetentionPolicy)

Aggregations

TimeAndVersionRetentionPolicy (com.ms.silverking.cloud.dht.TimeAndVersionRetentionPolicy)1 TimeAndVersionRetentionState (com.ms.silverking.cloud.dht.TimeAndVersionRetentionState)1 ValueRetentionPolicy (com.ms.silverking.cloud.dht.ValueRetentionPolicy)1