def put_sets(set_names, key, bin_name, value): """ Inserts the given key with the given bin with the given value into the given sets. """ for set_name in set_names: lib.write_record(set_name, key, [bin_name], [value])
def prepare_bins(): """ Creates two records with generation count 1. """ lib.write_record(lib.SET, "key-1", [u"bin-1", u"bin-2"], [u"value-1b", u"value-2b"]) lib.write_record(lib.SET, "key-2", [u"bin-1", u"bin-2"], [u"value-1b", u"value-2b"])
def put_data(context): """ Inserts the test data that we'll then filter. """ lib.write_record(SET_NAME_1, KEY, [BIN_NAME_1, BIN_NAME_2], [VALUE_1, VALUE_2]) lib.write_record(SET_NAME_2, KEY, [BIN_NAME_1, BIN_NAME_2], [VALUE_1, VALUE_2]) lib.create_string_index(SET_NAME_1, BIN_NAME_1, INDEX_NAME_1) lib.create_string_index(SET_NAME_2, BIN_NAME_2, INDEX_NAME_2) context["udf_file"] = os.path.basename(lib.put_udf_file(UDF_FILE_DATA))
def fill_bins(): """ Creates two records, one with generation count 2, the other with 1. """ lib.write_record(lib.SET, "key-1", [u"bin-1"], [u"dummy"]) lib.write_record(lib.SET, "key-1", [u"bin-1"], [u"value-1a"]) lib.write_record(lib.SET, "key-2", [u"bin-1"], [u"value-1a"])
def put_keys(set_name, keys, value, send_key): """ Inserts the given keys with a single "value" bin with the given value. """ for key in keys: lib.write_record(set_name, key, [u"value"], [value], send_key)
def put_bins(set_name, key, bin_names, value): """ Inserts the given key with the given bins with the given value. """ values = [value] * len(bin_names) lib.write_record(set_name, key, bin_names, values)
def put_values(set_name, key, values): """ Inserts the given key with bins "bin-0" ... "bin-<n>" with the n given values. """ bin_names = [u"bin-" + str(index) for index in xrange(len(values))] lib.write_record(set_name, key, bin_names, values)
def put_ttl(key, ttl): """ Inserts the given key with the given TTL. """ lib.write_record(lib.SET, key, [u"value"], [u"value"], False, ttl)
def filler(): """ Fills the namespace with a few records. """ for index in xrange(10000): lib.write_record(lib.SET, index, [u"bin-1"], [index])