class Snapsync::DefaultSyncPolicy

Default synchronization policy

Synchronization policy objects are used by the synchronization passes to decide which snapshots to copy and which to not copy. They have to provide {#filter_snapshots}.

This default policy is to copy everything but the snapsync-created synchronization points that are not involving the current target

Public Class Methods

from_config(config) click to toggle source
# File lib/snapsync/default_sync_policy.rb, line 16
def self.from_config(config)
    new
end

Public Instance Methods

filter_snapshots(snapshots) click to toggle source

Returns the snapshots that should be synchronized according to this policy

@param [#uuid] target the target object @param [Array<Snapshot>] the snapshot candidates @return [Array<Snapshot>] the snapshots that should be copied

# File lib/snapsync/default_sync_policy.rb, line 30
def filter_snapshots(snapshots)
    # Filter out any snapsync-generated snapshot
    snapshots.find_all { |s| !s.synchronization_point? }
end
pretty_print(pp) click to toggle source

Pretty prints this policy

This is used by the CLI to give information about a target to the user

# File lib/snapsync/default_sync_policy.rb, line 38
def pretty_print(pp)
    pp.text "default policy"
end
to_config() click to toggle source
# File lib/snapsync/default_sync_policy.rb, line 20
def to_config
    Array.new
end