Introduction

This SDK has been created to simplify creation of software that will function as an offloading client, receiving responses from Tachyon.

The Offloading SDK provides a managed DLL for use in an ASP.NET application. This helps create a Tachyon offloading target. The DLL contains a definition for the class encapsulating the responses received from Tachyon. It also includes a code for unpacking and decompressing the information Tachyon sends.

On this page:

Creating an Offloading Target

The OffloadTarget needs to accept HTTP POSTs. If coded in .NET, it would typically be a WebApi application.

The DLL provided by the SDK is named Tachyon.SDK.Offloading.dll. After referencing the DLL from the WebApi project and importing the Tachyon.SDK.Offloading namespace, an action method that receives the posts can be as short as this:

Offloading target
        public HttpResponseMessage Post([CustomBody]byte[] responses)
        {
            if (responses == null)
            {
                return new HttpResponseMessage(HttpStatusCode.BadRequest);
            }
 
            ResponseRaw[] responseRaws = JsonResponseDeserializer.DeserializeObject(responses);
            ProcessResponses(responseRaws);
            return new HttpResponseMessage(HttpStatusCode.Accepted);
        }

The most important line is:

ResponseRaw
     ResponseRaw[] responseRaws = JsonResponseDeserializer.DeserializeObject(responses);
  • ResponseRaw - defined in the SDK DLL encapsulating raw responses offloaded from Tachyon
  • JsonResponseDeserializer.DeserializeObject - converts bytes received into raw responses, and handles decompression as required
  • [CustomBody] - captures raw posted data so it can be passed into DeserializeObject for decompression

For an explanation of why [CustomBody] is needed and why the default WebApi binding won't work as expected, read:

Accepting Raw Request Body Content with ASP.NET Web API - https://weblog.west-wind.com/posts/2013/Dec/13/Accepting-Raw-Request-Body-Content-with-ASPNET-Web-API.

In the above example, the method ProcessResponses would contain the custom code that processes the data received from Tachyon.

Sample code

The Tachyon Server code repository contains a sample project that consumes the SDK DLL. It's calledvTachyon.Server.OffloadingClient and is located under the Tools folder.