Optional<TypedByteBuffer> getTypedValueBuffer(final Txn<ByteBuffer> txn,
                                                  final ByteBuffer valueStoreKeyBuffer) {
        // Lookup the passed key in the ValueStoreMetaDb to determine the value type
        // If found use the same key to look up the actual value and return it
        // with the type information.
        final Byte optTypeId = valueStoreMetaDb.getTypeId(txn, valueStoreKeyBuffer);
        if (optTypeId != null) {
            final ByteBuffer valueBuffer = valueStoreDb.getAsBytes(txn, valueStoreKeyBuffer)
                    .orElseThrow(() -> new RuntimeException(
                            "If we have a meta entry we should also have a value entry, data may be corrupted"));
            return Optional.of(new TypedByteBuffer(optTypeId, valueBuffer));
        } else {
            return Optional.empty();
        }
    }
Either gets the {@link ValueStoreKey} corresponding to the passed refDataValue
from the database if we already hold it or creates the entry in the database
and returns the generated key. To determine if we already hold it, the value
will be hashed and that hash will be looked up and any matches tested for equality
using the serialised bytes.
<p>
onExistingValueAction Action to perform when the value is found to already exist

@return A clone of the {@link ByteBuffer} containing the database key.
stroom-pipeline/src/main/java/stroom/pipeline/refdata/store/offheapstore/ValueStore.java