Search in sources :

Example 1 with GridFilesystem

use of org.jgroups.blocks.GridFilesystem in project JGroups by belaban.

the class GridFilesystemTest method main.

public static void main(String[] args) throws Exception {
    String props = "udp.xml";
    String cluster_name = "imfs-cluster";
    String metadata_cluster_name = "metadata-cluster";
    short default_repl_count = 1;
    int default_chunk_size = 4000;
    GridFilesystem fs;
    for (int i = 0; i < args.length; i++) {
        if (args[i].equals("-props")) {
            props = args[++i];
            continue;
        }
        if (args[i].equals("-cluster_name")) {
            cluster_name = args[++i];
            continue;
        }
        if (args[i].equals("-metadata_cluster_name")) {
            metadata_cluster_name = args[++i];
            continue;
        }
        if (args[i].equals("-repl_count")) {
            default_repl_count = Short.parseShort(args[++i]);
            continue;
        }
        if (args[i].equals("-chunk_size")) {
            default_chunk_size = Integer.parseInt(args[++i]);
            continue;
        }
        System.out.println("GridFilesystemTest [-props <JGroups config>] [-cluster_name <name>] " + "[-metadata_cluster_name <name>] [-repl_count <count>] [-chunk_size <size (bytes)>]");
        return;
    }
    ReplCache<String, byte[]> data = new ReplCache<>(props, cluster_name);
    ReplCache<String, GridFile.Metadata> metadata = new ReplCache<>(props, metadata_cluster_name);
    data.start();
    metadata.start();
    fs = new GridFilesystem(data, metadata, default_repl_count, default_chunk_size);
    loop(fs);
    data.stop();
    metadata.stop();
}
Also used : GridFilesystem(org.jgroups.blocks.GridFilesystem) ReplCache(org.jgroups.blocks.ReplCache)

Aggregations

GridFilesystem (org.jgroups.blocks.GridFilesystem)1 ReplCache (org.jgroups.blocks.ReplCache)1