Oasis config.

Oasis config.

# Sandstorm Blackrock
# Copyright (c) 2015 Sandstorm Development Group, Inc.
# All Rights Reserved

@0xf58bc2dacec400ce;

$import "/capnp/c++.capnp".namespace("blackrock");

struct MasterConfig {
  workerCount @0 :UInt32;

  # For now, we expect exactly one of each of the other machine types.

  frontendConfig @1 :import "frontend.capnp".FrontendConfig;

  union {
    vagrant @2 :VagrantConfig;
    gce @3 :GceConfig;
  }
}

struct VagrantConfig {}

struct GceConfig {
  project @0 :Text;
  zone @1 :Text;
  instanceTypes :group {
    storage @2 :Text = "n1-standard-1";
    worker @3 :Text = "n1-highmem-2";
    coordinator @4 :Text = "n1-standard-1";
    frontend @5 :Text = "n1-standard-1";
    mongo @6 :Text = "n1-standard-1";
  }
}

const vagrantConfig :MasterConfig = (
  workerCount = 2,
  frontendConfig = (
    baseUrl = "http://localrock.sandstorm.io:6080",
    wildcardHost = "*.localrock.sandstorm.io:6080",
    allowDemoAccounts = false,
    isTesting = true
  ),
  vagrant = ()
);

const gceTestConfig :MasterConfig = (
  workerCount = 2,
  frontendConfig = (
    baseUrl = "https://testrock.sandstorm.io",
    wildcardHost = "*.testrock.sandstorm.io",
    allowDemoAccounts = false,
    isTesting = true
  ),
  gce = (
    project = "sandstorm-blackrock-testing",
    zone = "us-central1-f",
    instanceTypes = (
      storage = "g1-small",
      worker = "n1-standard-1",
      coordinator = "g1-small",
      frontend = "g1-small",
      mongo = "g1-small"
    )
  )
);

const gceOasisConfig :MasterConfig = (
  workerCount = 2,
  frontendConfig = (
    baseUrl = "https://oasis.sandstorm.io",
    wildcardHost = "*.oasis.sandstorm.io",
    ddpUrl = "https://ddp.oasis.sandstorm.io",
    allowDemoAccounts = false,
    isTesting = false
  ),
  gce = (
    project = "sandstorm-oasis",
    zone = "us-central1-f"
  )
);


Expanded rules to include where clauses in schema

@0xaaef86128cdda946;
interface Holmes {
  # Values
  struct Val {
    union {
      uint64 @0 :UInt64;
      string @1 :Text;
      blob   @2 :Data;
    }
  }

  struct HType {
    union {
      uint64 @0 :Void;
      string @1 :Void;
      blob   @2 :Void;
    }
  }

  # Variables
  using Var = UInt32;

  # Logical facts
  using PredName = Text;
  struct Fact {
    predicate @0 :PredName;
    args      @1 :List(Val);
  }

  struct BodyExpr {
    union {
      unbound @0 :Void;
      var     @1 :Var;
      const   @2 :Val;
    }
  }

  struct BodyClause {
    predicate @0 :PredName;
    args      @1 :List(BodyExpr);
  }

  struct FExpr {
    func @0 :Text;
    args @1 :List(Expr);
  }

  struct Expr {
    union {
      var @0 :Var;
      const @1 :Val;
      app @2 : FExpr;
    }
  }

  struct WhereClause {
    lhs @0 :List(BodyExpr);
    rhs @1 :Expr;
  }

  struct Rule {
    head @0 :BodyClause;
    body @1 :List(BodyClause);
    where @2 :List(WhereClause);
  }

  interface HFunc {
    types @0 ()->(inputTypes  : List(HType),
                  outputTypes : List(HType));
    run @1 (args :List(Val)) -> (results :List(Val));
  }

  # Register a predicate
  newPredicate @0 (predName :PredName,
                   argTypes :List(HType)) -> (valid :Bool);

  # Add a fact to the extensional database
  newFact @1 (fact :Fact);

  # Ask the server to search or expand the intensional database
  # searching for a set of facts that matches a body clause
  # Returns the list of satisfying assignments to the body clauses.
  derive @2 (query :List(BodyClause)) -> (ctx :List(List(Val)));

  # Add a rule to expand the intentional database
  newRule @3 (rule :Rule) -> ();

  # Register a new external function
  newFunc @4 (name :Text, func :HFunc);
}

@0xaaef86128cdda946;
interface Holmes {
  # Values
  struct Val {
    union {
      uint64 @0 :UInt64;
      string @1 :Text;
      blob   @2 :Data;
    }
  }

  struct HType {
    union {
      uint64 @0 :Void;
      string @1 :Void;
      blob   @2 :Void;
    }
  }

  # Variables
  using Var = UInt32;

  # Logical facts
  using PredName = Text;
  struct Fact {
    predicate @0 :PredName;
    args      @1 :List(Val);
  }

  struct BodyExpr {
    union {
      unbound @0 :Void;
      var     @1 :Var;
      const   @2 :Val;
    }
  }

  struct BodyClause {
    predicate @0 :PredName;
    args      @1 :List(BodyExpr);
  }

  struct Rule {
    head @0 :BodyClause;
    body @1 :List(BodyClause);
  }

  interface HFunc {
    types @0 ()->(inputTypes  : List(HType),
                  outputTypes : List(HType));
    run @1 (args :List(Val)) -> (results :List(Val));
  }

  # Register a predicate
  newPredicate @0 (predName :PredName,
                   argTypes :List(HType)) -> (valid :Bool);

  # Add a fact to the extensional database
  newFact @1 (fact :Fact);

  # Ask the server to search or expand the intensional database
  # searching for a set of facts that matches a body clause
  # Returns the list of satisfying assignments to the body clauses.
  derive @2 (query :List(BodyClause)) -> (ctx :List(List(Val)));

  # Add a rule to expand the intentional database
  newRule @3 (rule :Rule) -> ();

  # Register a new external function
  newFunc @4 (name :Text, func :HFunc);
}