hudson.plugins.mercurial
Class Cache

java.lang.Object
  extended by hudson.plugins.mercurial.Cache

 class Cache
extends java.lang.Object

Mercurial repository that serves as a cache to hg operations in the Hudson cluster.

This substantially improves the performance by reducing the amount of data that needs to be transferred. One cache will be built on the Hudson master, then per-slave cache is cloned from there.

Author:
Jesse Glick
See Also:
manages repository caches.

Field Summary
private static java.util.Map<java.lang.String,Cache> CACHES
           
private  java.lang.String hash
          Hashed value of remote that only contains characters that are safe as a directory name.
private  java.util.concurrent.locks.ReentrantLock lock
          Mutual exclusion to the access to the cache.
private  java.lang.String remote
          The remote source repository that this repository is caching.
 
Constructor Summary
private Cache(java.lang.String remote, java.lang.String hash)
           
 
Method Summary
static Cache fromURL(java.lang.String remote)
           
(package private) static java.lang.String hashSource(java.lang.String source)
          Hash a URL into a string that only contains characters that are safe as directory names.
(package private)  FilePath repositoryCache(MercurialSCM config, Node node, Launcher launcher, TaskListener listener, boolean fromPolling)
          Returns a local hg repository cache of the remote repository specified in the given MercurialSCM on the given Node, fully updated to the tip of the current remote repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

remote

private final java.lang.String remote
The remote source repository that this repository is caching.


hash

private final java.lang.String hash
Hashed value of remote that only contains characters that are safe as a directory name.


lock

private final java.util.concurrent.locks.ReentrantLock lock
Mutual exclusion to the access to the cache.


CACHES

private static final java.util.Map<java.lang.String,Cache> CACHES
Constructor Detail

Cache

private Cache(java.lang.String remote,
              java.lang.String hash)
Method Detail

fromURL

@NonNull
public static Cache fromURL(java.lang.String remote)

repositoryCache

@CheckForNull
FilePath repositoryCache(MercurialSCM config,
                                      Node node,
                                      Launcher launcher,
                                      TaskListener listener,
                                      boolean fromPolling)
                   throws java.io.IOException,
                          java.lang.InterruptedException
Returns a local hg repository cache of the remote repository specified in the given MercurialSCM on the given Node, fully updated to the tip of the current remote repository.

Parameters:
node - The node that gets a local cached repository.
Returns:
The file path on the node to the local repository cache, cloned off from the master cache.
Throws:
java.io.IOException
java.lang.InterruptedException

hashSource

static java.lang.String hashSource(java.lang.String source)
Hash a URL into a string that only contains characters that are safe as directory names.



Copyright © 2010. All Rights Reserved.