Skip to content

parallaxsecond/parsec-client-go

Repository files navigation

PARSEC logo

PARSEC Go Client

This repository contains a PARSEC Go Client library. The library contains methods to communicate using the wire protocol.


👿WARNING

The current status of this interface is suitable only for review of the API. It is a work in progress. There are ommissions and testing is very minimal at this stage.


Build Status

Build and Test Continuous Integration

Usage

Sample usage can be found in the end to end tests in the e2etest folder

Parsec Service Socket Configuration

This client will, connect to the parsec service on a URL defined using the PARSEC_SERVICE_ENDPOINT environment variable. This URL must be for the unix scheme (no other schemes are supported at this time).

If the PARSEC_SERVICE_ENDPOINT environment variable is not set, then the default value of unix:/run/parsec/parsec.sock is used.

Parsec Interface Version

The parsec interface is defined in google protocol buffers .proto files, included in the parsec operations, which is included as a git submodule in the interface/parsec-operations folder in this repository. This submodule is currently pinned to parsec-operations v0.6.0

The protocol buffers files are used to generate translation golang code which is checked into this repository to remove the requirement for developers using this library to install protoc.

Interface Generation

Prerequisites

You will need protoc 3+ installed as well as gcc.

You will also need the go plugin for protoc

On ubuntu 20.04, the following will install the tools you need:

# protoc and gcc
apt-get install protoc build-essential
# go plugin
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26

Generation

To update the generated files, run the following in this folder (protoc and make required)

make clean-protobuf
make protoc
make build

Testing

To run unit tests:

make test

To run continuous integration tests (requires docker). This will run up docker container that will run the parsec daemon and then run a series of end to end tests.

make ci-test-all
# can also be run using
./e2etest/scripts/ci-all.sh

All code for the end to end tests is in the e2etest folder.

Black box unit tests for folders are found in a test folder under the main package folder (e.g. for algorithm parsec/algorithm/test)

Internal tests for packages will be in the relevant package folders as required by go, and will be called xxx_internal_test.go

Folder Structure

  • This folder General files that must be at the top level - readmes, licence, lint configurations, etc.
  • .github/workflows Github Build CI action definitions - CI testing, build, unit test, static analysis...
  • e2etest End to End testing - Docker containers to fire up parsec and run end to end tests. Also used in CI end to end testing.
  • interface The Google Protocol Buffers basic client for communicating with the parsec daemon. This provides the underlying interface to parsec, but is not intended for client application use.
  • parsec This is the public interface of the Parsec Go client.

License

The software is provided under Apache-2.0. Contributions to this project are accepted under the same license.

This project uses the following third party libraries:

  • golang.org/x/sys BSD-3-Clause
  • google.golang.org/protobuf BSD-3-Clause
  • github.com/sirupsen/logrus MIT

Contributing

Please check the Contributing to know more about the contribution process.