Start a Conversation

Unsolved

This post is more than 5 years old

850

January 8th, 2014 08:00

Checksum protection in Atmos storage cloud .NET API

May I ask if Atmos storage cloud .NET API supports checksum protection?

"Atmos supports end-to-end SHA0 checksum protection for objects created with the REST interface that are stored in erasure coded replicas. Note: Atmos does not reject checksum requests for data stored in non-EC replica types, but it does not ensure end-to-end protection for them." [1]

"To invoke checksum protection on a create or update request include the x-emc-wschecksum custom header. The x-emc-checksum header includes: x-emc-wschecksum: algorithm/offset/checksumValue" [1]

Maybe this can be achieved by passing the metadata in CreateObject(), etc., but is there an API function to calculate the SHA0 checksum (which will match that on the server side)?

"

ObjectId CreateObject(

    Acl acl,

    MetadataList metadata,

    byte[] data,

    string mimeType

)

Parameters

acl (Acl)

Access control list for the new object. May be null to use a default ACL

metadata (MetadataList)

Metadata for the new object. May be null for no metadata.

data (byte[])

The initial contents of the object. May be appended to later. May be null to create an object with no content.

mimeType (string)

the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.

"

"offset— Specifies the offset where the algorithm was calculated."

May I ask what does 'offset' exactly specify? Is the checksum calculated cumulatively from the beginning of the data in the object (or for data in every CreateObject() and UpdateObject() call each starting on a different 'offset')?

"On a create request, you must pass in the checksum value for the complete object."

Is here by 'for the complete object' meant 'for data passed to every individual CreateObject() or UpdateObject() call' or 'for data passed to all CreateObject() and UpdateObject() calls'?

May I take advantage of this occasion and also ask if there is a way in .NET API to write an Atmos object as a stream (not knowing the size of the data in the stream and somehow mark the end of the stream by say sending zero bytes)?

Thanks.

References

1. EMC® Atmos™ Version 1.4.1 Programmer’s Guide.

281 Posts

January 30th, 2014 10:00

Hi Robert,

You'll see there's an overloaded version of CreateObject that takes a "Checksum" parameter.  Before calling this, you construct a new Checksum object with your algorithm of choice (as of 2.1.0 we support SHA0, SHA1, and MD5).

The resulting code will look something like this:

    Checksum ck = new Checksum( EsuApiLib.Checksum.Algorithm.SHA0 );

    ObjectId id = this.esu.CreateObject( null, null, Encoding.UTF8.GetBytes("hello"), "text/plain", ck );

No Events found!

Top