Sha256: e5aa68c4969225fbb53b6304e62a6a95bd33bde8547c62bbc11eddd06ca840d3

Contents?: true

Size: 622 Bytes

Versions: 18

Compression:

Stored size: 622 Bytes

Contents

module Snapsync
    # A simple policy that synchronizes only the last snapshot (that is,
    # snapsync's own synchronization point)
    class SyncLastPolicy
        def self.from_config(config)
            new
        end

        def to_config
            Array.new
        end

        def pretty_print(pp)
            pp.text "will keep only the latest snapshot"
        end

        # (see DefaultSyncPolicy#filter_snapshots)
        def filter_snapshots(snapshots)
            last = snapshots.sort_by(&:num).reverse.
                find { |s| !s.synchronization_point? }
            [last]
        end
    end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
snapsync-0.5.0 lib/snapsync/sync_last_policy.rb
snapsync-0.4.2 lib/snapsync/sync_last_policy.rb
snapsync-0.4.1 lib/snapsync/sync_last_policy.rb
snapsync-0.4.0 lib/snapsync/sync_last_policy.rb
snapsync-0.3.8 lib/snapsync/sync_last_policy.rb
snapsync-0.3.7 lib/snapsync/sync_last_policy.rb
snapsync-0.3.6 lib/snapsync/sync_last_policy.rb
snapsync-0.3.5 lib/snapsync/sync_last_policy.rb
snapsync-0.3.4 lib/snapsync/sync_last_policy.rb
snapsync-0.3.3 lib/snapsync/sync_last_policy.rb
snapsync-0.3.2 lib/snapsync/sync_last_policy.rb
snapsync-0.3.1 lib/snapsync/sync_last_policy.rb
snapsync-0.3.0 lib/snapsync/sync_last_policy.rb
snapsync-0.2.1 lib/snapsync/sync_last_policy.rb
snapsync-0.2.0 lib/snapsync/sync_last_policy.rb
snapsync-0.1.8 lib/snapsync/sync_last_policy.rb
snapsync-0.1.7 lib/snapsync/sync_last_policy.rb
snapsync-0.1.6 lib/snapsync/sync_last_policy.rb