Is there a way of getting/setting only part of a binary bin?

Hi,

is there a way in Java client to set/get only a part (a segment) of a binary blob bin?

Best, Peter Knego

Peter,

Unit of add / update in Aerospike is a single bin for the non complex type (Complex type List / Map). Blob is a non-complex type.

If BLOB is pretty big compared to the data being hcange then. Possible alternative would be to split the blob into small pieces of reasonable size and add it to LIST and put it in bin. Then you can actually use the UDF to only add or update a single chunk.

NB: UDF generally have other overheads in execution and list in terms of space requirement. So you may have to measure the tradeoffs in terms of what works better changing entire blob or a chunk of blob in list using UDF.

HTH

– R

I would consider looking into the BYTES lua datatype ( https://www.aerospike.com/docs/udf/api/bytes.html). However, after reading Rajkumar’s answer, I wonder if there is any limitation to their usage other than that the bin ofc needs to be of type bytes (see https://www.aerospike.com/docs/guide/data-types.html) because of the proposed ‘split up into many chunks’-solution. I haven’t used the bytes function myself, therefore I cannot say anything about that, how benefitial they are (and at what BLOB sizes) but I used similiar functions with other NoSQL-DBs and they typically ‘do the job’ for any kind of small change.

Those udf’s can be invoked from any client library, as far as I know.

Cheers, Manuel

Manuel, Your suggestion seems to be a better alternative than what I suggested :smile:

Cheers

R

1 Like