Class StoreKeys

java.lang.Object
me.ahoo.cosid.store.StoreKeys

public final class StoreKeys extends Object
The keys every backend stores alike (R1-spi-02, 06-stores.md ยง1): namespaces, the names of generators and machines, and the range and owner keys made from them. A key that one backend cannot store fails at start-up on every backend, so a configuration moves between backends unchanged.
  • A namespace: 1 to 100 of A-Z a-z 0-9 . _ : -, starting with a letter or digit (the JDBC namespace column; a ZooKeeper node name; a Redis hash tag).
  • A name: not empty, without /, not . nor .., without whitespace (SQL Server ignores trailing spaces when it compares; cosid-server refuses blanks in a range key), and without a character ZooKeeper refuses in a path: controls, surrogates, U+E000..U+F8FF and U+FFF0..U+FFFF.
  • A range key (namespace/name, namespace/name/period) and an owner key: at most 255 UTF-16 units (the JDBC varchar(255) / nvarchar(255) columns), without leading or trailing whitespace nor a character ZooKeeper refuses.
  • Field Details

    • MAX_NAMESPACE_LENGTH

      public static final int MAX_NAMESPACE_LENGTH
      The longest namespace.
      See Also:
    • MAX_KEY_LENGTH

      public static final int MAX_KEY_LENGTH
      The longest range key or owner key.
      See Also:
  • Method Details

    • isNamespace

      public static boolean isNamespace(String namespace)
      Whether every backend stores this namespace.
      Parameters:
      namespace - the namespace
      Returns:
      true if it is portable
    • namespaceProblem

      public static Optional<String> namespaceProblem(String namespace)
      Why a namespace is not portable.
      Parameters:
      namespace - the namespace
      Returns:
      the problem; empty when it is portable
    • nameProblem

      public static Optional<String> nameProblem(String name)
      Why a generator or machine name is not portable.
      Parameters:
      name - the name
      Returns:
      the problem; empty when it is portable
    • keyProblem

      public static Optional<String> keyProblem(String what, String key)
      Why a range key or owner key is not portable.
      Parameters:
      what - the kind of key, for the problem
      key - the key
      Returns:
      the problem; empty when it is portable