private AppProfile(@Nonnull com.google.bigtable.admin.v2.AppProfile proto) { Preconditions.checkNotNull(proto); Preconditions.checkArgument( proto.hasSingleClusterRouting() || proto.hasMultiClusterRoutingUseAny(), "AppProfile must have a routing policy"); Preconditions.checkArgument(!proto.getName().isEmpty(), "AppProfile must have a name"); this.proto = proto; }
/** Gets the routing policy for all read/write requests which use this app profile. */ @SuppressWarnings("WeakerAccess") public RoutingPolicy getPolicy() { if (proto.hasMultiClusterRoutingUseAny()) { return MultiClusterRoutingPolicy.of(); } else if (proto.hasSingleClusterRouting()) { return new SingleClusterRoutingPolicy(proto.getSingleClusterRouting()); } else { // Should never happen because the constructor verifies that one must exist. throw new VerifyException(); } }
private AppProfile(@Nonnull com.google.bigtable.admin.v2.AppProfile proto) { Preconditions.checkNotNull(proto); Preconditions.checkArgument( proto.hasSingleClusterRouting() || proto.hasMultiClusterRoutingUseAny(), "AppProfile must have a routing policy"); Preconditions.checkArgument(!proto.getName().isEmpty(), "AppProfile must have a name"); this.proto = proto; }
/** Gets the routing policy for all read/write requests which use this app profile. */ @SuppressWarnings("WeakerAccess") public RoutingPolicy getPolicy() { if (proto.hasMultiClusterRoutingUseAny()) { return MultiClusterRoutingPolicy.of(); } else if (proto.hasSingleClusterRouting()) { return new SingleClusterRoutingPolicy(proto.getSingleClusterRouting()); } else { // Should never happen because the constructor verifies that one must exist. throw new VerifyException(); } }