public static Supplier progression()

in harry-core/src/harry/ddl/SchemaGenerators.java [453:481]


    public static Supplier<SchemaSpec> progression(int switchAfter)
    {
        Supplier<SchemaSpec>[] generators = new Supplier[PROGRESSIVE_GENERATORS.length];
        for (int i = 0; i < generators.length; i++)
            generators[i] = PROGRESSIVE_GENERATORS[i].toSupplier();

        return new Supplier<SchemaSpec>()
        {
            private int counter = 0;
            public SchemaSpec get()
            {
                int idx = (counter / switchAfter) % generators.length;
                counter++;
                SchemaSpec spec = generators[idx].get();
                int tries = 100;
                while ((spec.pkGenerator.byteSize() != Long.BYTES) && tries > 0)
                {
                    System.out.println("Skipping schema, since it doesn't have enough entropy bits available: " + spec.compile().cql());
                    spec = generators[idx].get();
                    tries--;
                }

                spec.validate();

                assert tries > 0 : String.format("Max number of tries exceeded on generator %d, can't generate a needed schema", idx);
                return spec;
            }
        };
    }