phylum

package
v0.0.0-...-88c334c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

README

Phylum: Chaincode Business Logic

The phylum stores chaincode business logic. This phylum defines a route for each of the 3 application API endpoints (see routes.lisp). This code securely runs on all of the participant nodes in the network, and the platform ensures that these participants reach agreement on the execution of this code.

See Phylum Best Practices.

Directory Structure

build:
	Temporary build artifacts (do not check into git).
main.lisp:
	Entrypoint into the chainocode.
phylum.go:
	Go library for off-chain service to interact with phylum.
routes.lisp:
	Routes callable by off-chain services.
utils.lisp:
	Common utility functions for the app.
utils_test.lisp:
	ELPS tests for the utility functions.

Making changes

Testing Changes

The phylum can define unit tests in files with names ending it _test.lisp. These tests can be run using the following command:

make test

From the project's top level make phylumtest will run the same tests.

Formatting Changes

You need to install the yasi command line tool to use the make format target. This tool is installed using pip which requires python:

brew install pip
pip install --upgrade yasi

And to format:

make format

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	GetLogMetadata func(context.Context) logrus.Fields
	// contains filtered or unexported fields
}

Client is a phylum client.

func New

func New(endpoint string, log *logrus.Entry) (*Client, error)

New returns a new phylum client.

func NewMock

func NewMock(phylumPath string, log *logrus.Entry) (*Client, error)

NewMock returns a mock phylum client.

func NewMockFrom

func NewMockFrom(phylumPath string, log *logrus.Entry, r io.Reader) (*Client, error)

NewMockFrom returns a mock phylum client restored from a DB snapshot.

func (*Client) Close

func (s *Client) Close() error

Close closes the client if necessary.

func (*Client) CreateAccount

func (s *Client) CreateAccount(ctx context.Context, req *pb.CreateAccountRequest, config ...Config) (*pb.CreateAccountResponse, error)

CreateAccount is an example endpoint to create a resource.

func (*Client) DeleteAccount

func (s *Client) DeleteAccount(ctx context.Context, req *pb.DeleteAccountRequest, config ...Config) (*pb.DeleteAccountResponse, error)

func (*Client) GetAccount

func (s *Client) GetAccount(ctx context.Context, req *pb.GetAccountRequest, config ...Config) (*pb.GetAccountResponse, error)

GetAccount is an example query endpoint

func (*Client) GetUserAccounts

func (s *Client) GetUserAccounts(ctx context.Context, req *pb.GetUserAccountsRequest, config ...Config) (*pb.GetUserAccountsResponse, error)

func (*Client) HealthCheck

func (s *Client) HealthCheck(ctx context.Context, services []string, config ...Config) (*pb.HealthCheckResponse, error)

HealthCheck performs health check on phylum.

func (*Client) MockSnapshot

func (s *Client) MockSnapshot(w io.Writer) error

MockSnapshot copies the current state of the mock backend out to the supplied io.Writer.

func (*Client) Transfer

func (s *Client) Transfer(ctx context.Context, req *pb.TransferRequest, config ...Config) (*pb.TransferResponse, error)

func (*Client) UpdateAccount

func (s *Client) UpdateAccount(ctx context.Context, req *pb.UpdateAccountRequest, config ...Config) (*pb.UpdateAccountResponse, error)

UpdateAccount is an example endpoint to update a resource.

type Config

type Config = shiroclient.Config

Config is an alias (not a distinct type)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL