Giter Club home page Giter Club logo

alvarium-sdk-go's Introduction

alvarium-sdk-go

This is a re-implementation of the Alvarium SDK in Go. It borrows conceptually from the original implementation while updating functionality for IOTA Streams support.

A direct link to the IOTA C bindings directory is here.

Environment Variable Setup

In order to execute the unit tests for the SDK, you will need to export an environment variable that points to the directory containing the C bindings once they have been compiled. As an example from my local machine, I have put the following directive into my ~/.profile

export LD_LIBRARY_PATH=/home/developer/Documents/github/project-alvarium/alvarium-sdk-go/internal/iota/include

This variable is necessary for make test to execute a build prior to running the suite of unit tests

SDK Interface

The SDK provides a minimal API -- NewSdk(), Create(), Mutate(), Transit(), Publish() and BootstrapHandler().

NewSdk()

func NewSdk(annotators []annotator.Contract, cfg config.SdkInfo, logger logInterface.Logger) interfaces.Sdk

Used to instantiate a new SDK instance with the specified list of annotators.

Takes a list of annotators, a populated configuration and a logger instance. Returns an SDK instance.

Create()

func (s *sdk) Create(ctx context.Context, data []byte)

Used to register creation of new data with the SDK. Passes data through the SDK instance's list of annotators.

SDK instance method. Parameters include:

  • ctx -- Provide a context that may be used by individual annotators
  • data -- The data being created represented as a byte array

Mutate()

func (s *sdk) Mutate(ctx context.Context, old, new []byte)

Used to register mutation of existing data with the SDK. Passes data through the SDK instance's list of annotators.

SDK instance method. Parameters include:

  • ctx -- Provide a context that may be used by individual annotators

  • old -- The source data item that is being modified, represented as a byte array

  • new -- The new data item resulting from the change, represented as a byte array

Calling this method will link the old data to the new in a lineage. Specific annotations will be applied to the new data element.

Transit()

func (s *sdk) Transit(ctx context.Context, data []byte)

Used to annotate data that is neither originated or modified but simply handed from one application to another.

SDK instance method. Parameters include:

  • ctx -- Provide a context that may be used by individual annotators

  • data -- The data being handled represented as a byte array

Publish()

func (s *sdk) Publish(ctx context.Context, data []byte)

Used to annotate data that is neither originated or modified but before being handed to another application.

SDK instance method. Parameters include:

  • ctx -- Provide a context that may be used by individual annotators

  • data -- The data being handled represented as a byte array

BootstrapHandler()

BootstrapHandler(ctx context.Context, wg *sync.WaitGroup) bool

SDK instance method. Ensures clean shutdown of the SDK and associated resources.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.