apiclient

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CTJSON     = "application/json"
	CTPackfile = "application/x-wrgl-packfile"
)

Variables

This section is empty.

Functions

func ExtractTicketFrom401 added in v0.13.4

func ExtractTicketFrom401(resp *http.Response) (asUri, ticket string)

func FindRemoteFor added in v0.10.4

func FindRemoteFor(db objects.Store, rs ref.Store, sum []byte) (string, error)

func IsHTTPError added in v0.13.0

func IsHTTPError(err error, statusCode int, message string) bool

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(origin string, logger logr.Logger, opts ...ClientOption) (*Client, error)

func (*Client) Commit

func (c *Client) Commit(branch, message, fileName string, file io.Reader, primaryKey []string, tid *uuid.UUID, opts ...RequestOption) (cr *payload.CommitResponse, err error)

func (*Client) CommitTransaction added in v0.10.1

func (c *Client) CommitTransaction(id uuid.UUID, opts ...RequestOption) (resp *http.Response, err error)

func (*Client) CreateTransaction added in v0.10.1

func (c *Client) CreateTransaction(req *payload.CreateTransactionRequest, opts ...RequestOption) (ctr *payload.CreateTransactionResponse, err error)

func (*Client) Diff

func (c *Client) Diff(sum1, sum2 []byte, opts ...RequestOption) (dr *payload.DiffResponse, err error)

func (*Client) DiscardTransaction added in v0.10.1

func (c *Client) DiscardTransaction(id uuid.UUID, opts ...RequestOption) (resp *http.Response, err error)

func (*Client) ErrHTTP

func (c *Client) ErrHTTP(resp *http.Response) error

func (*Client) GarbageCollect added in v0.10.1

func (c *Client) GarbageCollect(opts ...RequestOption) (resp *http.Response, err error)

func (*Client) GetBlocks

func (c *Client) GetBlocks(commit string, start, end int, format payload.BlockFormat, columns bool, opts ...RequestOption) (resp *http.Response, err error)

func (*Client) GetCommit

func (c *Client) GetCommit(sum []byte, opts ...RequestOption) (cr *payload.Commit, err error)

func (*Client) GetCommitProfile added in v0.8.0

func (c *Client) GetCommitProfile(sum []byte, opts ...RequestOption) (tblProf *objects.TableProfile, err error)

func (*Client) GetCommits

func (c *Client) GetCommits(head string, maxDepth int, opts ...RequestOption) (gcr *payload.GetCommitsResponse, err error)

func (*Client) GetHead

func (c *Client) GetHead(branch string, opts ...RequestOption) (com *payload.Commit, err error)

func (*Client) GetObjects added in v0.8.4

func (c *Client) GetObjects(tables [][]byte, opts ...RequestOption) (pr *packfile.PackfileReader, err error)

func (*Client) GetRefs

func (c *Client) GetRefs(prefixes, notPrefixes []string, opts ...RequestOption) (m map[string][]byte, err error)

func (*Client) GetRows

func (c *Client) GetRows(commit string, offsets []int, opts ...RequestOption) (resp *http.Response, err error)

func (*Client) GetTable

func (c *Client) GetTable(sum []byte, opts ...RequestOption) (tr *payload.GetTableResponse, err error)

func (*Client) GetTableBlocks added in v0.7.3

func (c *Client) GetTableBlocks(sum []byte, start, end int, format payload.BlockFormat, columns bool, opts ...RequestOption) (resp *http.Response, err error)

func (*Client) GetTableProfile added in v0.8.0

func (c *Client) GetTableProfile(sum []byte, opts ...RequestOption) (tblProf *objects.TableProfile, err error)

func (*Client) GetTableRows added in v0.7.3

func (c *Client) GetTableRows(sum []byte, offsets []int, opts ...RequestOption) (resp *http.Response, err error)

func (*Client) GetTransaction added in v0.10.1

func (c *Client) GetTransaction(id uuid.UUID, opts ...RequestOption) (gtr *payload.GetTransactionResponse, err error)

func (*Client) JsonRequest added in v0.13.0

func (c *Client) JsonRequest(method, path string, req any, opts ...RequestOption) (*http.Response, error)

func (*Client) PostMultipartForm

func (c *Client) PostMultipartForm(path string, value map[string][]string, files map[string]formFile, opts ...RequestOption) (*http.Response, error)

func (*Client) PostReceivePack added in v0.11.0

func (c *Client) PostReceivePack(updates map[string]*payload.Update, tableHaves [][]byte, opts ...RequestOption) (*http.Response, error)

func (*Client) PostUploadPack

func (c *Client) PostUploadPack(req *payload.UploadPackRequest, opts ...RequestOption) (upr *payload.UploadPackResponse, pr *packfile.PackfileReader, err error)

func (*Client) Request

func (c *Client) Request(method, path string, body *ReplayableBuffer, headers map[string]string, opts ...RequestOption) (resp *http.Response, err error)

func (*Client) ResetCookies added in v0.13.2

func (c *Client) ResetCookies() (err error)

type ClientOption added in v0.7.0

type ClientOption func(c *Client)

func WithCookies

func WithCookies(cookies []*http.Cookie) ClientOption

func WithForceAuthenticate added in v0.13.0

func WithForceAuthenticate() ClientOption

func WithHeader

func WithHeader(header http.Header) ClientOption

func WithRelyingPartyToken added in v0.13.0

func WithRelyingPartyToken(rpt string) ClientOption

func WithTransport added in v0.7.0

func WithTransport(transport http.RoundTripper) ClientOption

func WithUMATicketHandler added in v0.13.0

func WithUMATicketHandler(cb func(asURI, ticket, oldRPT string, logger logr.Logger) (rpt string, err error)) ClientOption

type ErrUnauthorized added in v0.13.0

type ErrUnauthorized struct {
	AuthServerURI string
	Ticket        string
}

func (*ErrUnauthorized) Error added in v0.13.0

func (err *ErrUnauthorized) Error() string

type HTTPError

type HTTPError struct {
	Code    int
	RawBody []byte
	Body    *payload.Error
}

func NewHTTPError

func NewHTTPError(resp *http.Response) *HTTPError

func UnwrapHTTPError added in v0.9.1

func UnwrapHTTPError(err error) *HTTPError

func (*HTTPError) Error

func (obj *HTTPError) Error() string

func (*HTTPError) Is added in v0.13.0

func (err *HTTPError) Is(target error) bool

type ReceivePackSession

type ReceivePackSession struct {
	// contains filtered or unexported fields
}

func NewReceivePackSession

func NewReceivePackSession(db objects.Store, rs ref.Store, c *Client, updates map[string]*payload.Update, remoteRefs map[string][]byte, maxPackfileSize uint64, opts ...RequestOption) (*ReceivePackSession, error)

func (*ReceivePackSession) Start

func (s *ReceivePackSession) Start(pc *pbar.Container) (updates map[string]*payload.Update, err error)

type RemoteFinder added in v0.10.4

type RemoteFinder struct {
	// contains filtered or unexported fields
}

func NewRemoteFinder added in v0.10.4

func NewRemoteFinder(db objects.Store, rs ref.Store) (*RemoteFinder, error)

func (*RemoteFinder) Close added in v0.10.4

func (f *RemoteFinder) Close() error

func (*RemoteFinder) FindRemoteFor added in v0.10.4

func (f *RemoteFinder) FindRemoteFor(sum []byte) (string, error)

type ReplayableBuffer added in v0.13.0

type ReplayableBuffer struct {
	// contains filtered or unexported fields
}

func NewReplayableBuffer added in v0.13.0

func NewReplayableBuffer() *ReplayableBuffer

func (*ReplayableBuffer) Close added in v0.13.0

func (b *ReplayableBuffer) Close() error

func (*ReplayableBuffer) Len added in v0.13.0

func (b *ReplayableBuffer) Len() int64

func (*ReplayableBuffer) Read added in v0.13.0

func (b *ReplayableBuffer) Read(p []byte) (n int, err error)

func (*ReplayableBuffer) Reset added in v0.13.0

func (b *ReplayableBuffer) Reset()

func (*ReplayableBuffer) Seek added in v0.13.0

func (b *ReplayableBuffer) Seek(offset int64, whence int) (int64, error)

func (*ReplayableBuffer) Write added in v0.13.0

func (b *ReplayableBuffer) Write(p []byte) (n int, err error)

type RequestOption

type RequestOption func(r *http.Request)

func WithRequestCookies added in v0.7.0

func WithRequestCookies(cookies []*http.Cookie) RequestOption

func WithRequestHeader added in v0.7.0

func WithRequestHeader(header http.Header) RequestOption

func WithRequestProgressBar added in v0.13.0

func WithRequestProgressBar(barContainer pbar.Container, total int64, message string) RequestOption

type ShallowCommitError added in v0.8.4

type ShallowCommitError struct {
	ComSumMap map[string]struct{}
	TableSums map[string][][]byte
}

func NewShallowCommitError added in v0.8.4

func NewShallowCommitError(db objects.Store, rs ref.Store, coms []*objects.Commit) *ShallowCommitError

func (*ShallowCommitError) CommitSums added in v0.10.4

func (e *ShallowCommitError) CommitSums() [][]byte

func (*ShallowCommitError) Error added in v0.8.4

func (e *ShallowCommitError) Error() string

type UploadPackOption added in v0.11.0

type UploadPackOption func(ses *UploadPackSession)

func WithUploadPackDepth added in v0.11.0

func WithUploadPackDepth(n int) UploadPackOption

func WithUploadPackHavesPerRoundTrip added in v0.11.0

func WithUploadPackHavesPerRoundTrip(n int) UploadPackOption

func WithUploadPackProgressBar added in v0.11.0

func WithUploadPackProgressBar(bar pbar.Bar) UploadPackOption

func WithUploadPackReceiverOptions added in v0.11.0

func WithUploadPackReceiverOptions(opts ...apiutils.ObjectReceiveOption) UploadPackOption

func WithUploadPackRequestOptions added in v0.11.0

func WithUploadPackRequestOptions(opts ...RequestOption) UploadPackOption

type UploadPackSession

type UploadPackSession struct {
	// contains filtered or unexported fields
}

func NewUploadPackSession

func NewUploadPackSession(db objects.Store, rs ref.Store, c *Client, advertised [][]byte, opts ...UploadPackOption) (*UploadPackSession, error)

func (*UploadPackSession) Start

func (n *UploadPackSession) Start() ([][]byte, error)

Jump to

Keyboard shortcuts

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