Interface Mirror


public interface Mirror
Contains the properties for a mirroring task and performs the task.
  • Method Details

    • id

      String id()
      Returns the ID of the mirroring task.
    • schedule

      @Nullable com.cronutils.model.Cron schedule()
      Returns the schedule for the mirroring task. null if the mirroring task is not scheduled.
    • nextExecutionTime

      ZonedDateTime nextExecutionTime(ZonedDateTime lastExecutionTime)
      Returns the next execution time of the mirroring task.
      Parameters:
      lastExecutionTime - the last execution time of the mirroring task
    • direction

      MirrorDirection direction()
      Returns the direction of the mirroring task.
    • credential

      Credential credential()
      Returns the authentication credentials which are required when accessing the Git repositories.
    • localRepo

      Repository localRepo()
      Returns the Central Dogma repository where is supposed to keep the mirrored files.
    • localPath

      String localPath()
      Returns the path in the Central Dogma repository where is supposed to keep the mirrored files.
    • remoteRepoUri

      URI remoteRepoUri()
      Returns the URI of the Git repository which will be mirrored from.
    • remotePath

      String remotePath()
      Returns the path of the Git repository where is supposed to be mirrored.
    • remoteBranch

      String remoteBranch()
      Returns the name of the branch in the Git repository where is supposed to be mirrored.
    • gitignore

      @Nullable String gitignore()
      Returns a gitignore pattern for the files which won't be mirrored.
    • enabled

      boolean enabled()
      Returns whether this Mirror is enabled.
    • zone

      @Nullable String zone()
      Returns the zone where this Mirror is pinned to.
    • mirror

      MirrorResult mirror(File workDir, CommandExecutor executor, int maxNumFiles, long maxNumBytes, Instant triggeredTime)
      Performs the mirroring task.
      Parameters:
      workDir - the local directory where keeps the mirrored files
      executor - the CommandExecutor which is used to perform operation to the Central Dogma storage
      maxNumFiles - the maximum number of files allowed to the mirroring task. A MirrorException would be raised if the number of files to be mirrored exceeds it.
      maxNumBytes - the maximum bytes allowed to the mirroring task. A MirrorException would be raised if the total size of the files to be mirrored exceeds it.
      triggeredTime - the time when the mirroring task is triggered.