/** * Initialize key from namespace, optional set name and user key. * The set name and user defined key are converted to a digest before sending to the server. * The user key is not used or returned by the server by default. If the user key needs * to persist on the server, use one of the following methods: * <ul> * <li>Set "WritePolicy.sendKey" to true. In this case, the key will be sent to the server for storage on writes * and retrieved on multi-record scans and queries.</li> * <li>Explicitly store and retrieve the key in a bin.</li> * </ul> * * @param namespace namespace * @param setName optional set name, enter null when set does not exist * @param key user defined unique identifier within set. * @throws AerospikeException if digest computation fails */ public Key(String namespace, String setName, Value key) throws AerospikeException { this.namespace = namespace; this.setName = setName; this.userKey = key; // Some value types can't be used as keys (jblob, list, map, null). Verify key type. key.validateKeyType(); digest = Crypto.computeDigest(setName, key); }
/** * Initialize key from namespace, optional set name and user key. * The set name and user defined key are converted to a digest before sending to the server. * The user key is not used or returned by the server by default. If the user key needs * to persist on the server, use one of the following methods: * <ul> * <li>Set "WritePolicy.sendKey" to true. In this case, the key will be sent to the server for storage on writes * and retrieved on multi-record scans and queries.</li> * <li>Explicitly store and retrieve the key in a bin.</li> * </ul> * * @param namespace namespace * @param setName optional set name, enter null when set does not exist * @param key user defined unique identifier within set. * @throws AerospikeException if digest computation fails */ public Key(String namespace, String setName, Value key) throws AerospikeException { this.namespace = namespace; this.setName = setName; this.userKey = key; // Some value types can't be used as keys (jblob, list, map, null). Verify key type. key.validateKeyType(); digest = Crypto.computeDigest(setName, key); }