payload

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: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HexSliceToBytesSlice

func HexSliceToBytesSlice(sl []*Hex) [][]byte

Types

type BlockFormat

type BlockFormat string
const (
	BlockFormatCSV    BlockFormat = "csv"
	BlockFormatBinary BlockFormat = "binary"
)

type CSVLocation

type CSVLocation struct {
	StartLine int `json:"startLine"` // Line where the record starts
	Line      int `json:"line"`      // Line where the error occurred
	Column    int `json:"column"`    // Column (1-based byte index) where the error occurred
}

func (*CSVLocation) Equal added in v0.13.0

func (a *CSVLocation) Equal(b *CSVLocation) bool

type Commit

type Commit struct {
	Sum           *Hex               `json:"sum,omitempty"`
	AuthorName    string             `json:"authorName,omitempty"`
	AuthorEmail   string             `json:"authorEmail,omitempty"`
	Message       string             `json:"message,omitempty"`
	Table         *Table             `json:"table,omitempty"`
	Time          time.Time          `json:"time,omitempty"`
	Parents       []*Hex             `json:"parents,omitempty"`
	ParentCommits map[string]*Commit `json:"parentCommits,omitempty"`
}

type CommitResponse

type CommitResponse struct {
	Sum   *Hex `json:"sum,omitempty"`
	Table *Hex `json:"table,omitempty"`
}

type CreateTransactionRequest added in v0.10.1

type CreateTransactionRequest struct {
	ID     string    `json:"id"`
	Begin  time.Time `json:"begin,omitempty"`
	End    time.Time `json:"end,omitempty"`
	Status string    `json:"status"`
}

type CreateTransactionResponse added in v0.10.1

type CreateTransactionResponse struct {
	ID string `json:"id"`
}

type DiffResponse

type DiffResponse struct {
	TableSum    *Hex                       `json:"tableSum"`
	OldTableSum *Hex                       `json:"oldTableSum"`
	OldPK       []uint32                   `json:"oldPK,omitempty"`
	PK          []uint32                   `json:"pk,omitempty"`
	OldColumns  []string                   `json:"oldColumns"`
	Columns     []string                   `json:"columns"`
	RowDiff     []*RowDiff                 `json:"rowDiff"`
	DataProfile *diffprof.TableProfileDiff `json:"dataProfile,omitempty"`
}

type Error

type Error struct {
	// Message is always present if there's an error. Otherwise this object
	// will be empty.
	Message string `json:"message,omitempty"` // The actual error

	// CSV appears when the error is a CSV parsing error
	CSV *CSVLocation `json:"csv,omitempty"`
}

func (*Error) Equal added in v0.13.0

func (a *Error) Equal(b *Error) bool

type GetCommitsResponse

type GetCommitsResponse struct {
	Sum  *Hex   `json:"sum,omitempty"`
	Root Commit `json:"root"`
}

type GetRefsResponse

type GetRefsResponse struct {
	Refs map[string]*Hex `json:"refs"`
}

type GetTableResponse

type GetTableResponse struct {
	Columns   []string `json:"columns,omitempty"`
	PK        []uint32 `json:"pk,omitempty"`
	RowsCount uint32   `json:"rowsCount"`
}

type GetTransactionResponse added in v0.10.1

type GetTransactionResponse struct {
	Status   string     `json:"status"`
	Begin    time.Time  `json:"begin"`
	End      *time.Time `json:"end,omitempty"`
	Branches []TxBranch `json:"branches"`
}

type Hex

type Hex [16]byte

func AppendHex

func AppendHex(sl []*Hex, b []byte) []*Hex

func BytesSliceToHexSlice added in v0.11.0

func BytesSliceToHexSlice(sl [][]byte) []*Hex

func BytesToHex

func BytesToHex(b []byte) *Hex

func (*Hex) MarshalJSON

func (x *Hex) MarshalJSON() ([]byte, error)

func (*Hex) String

func (x *Hex) String() string

func (*Hex) UnmarshalJSON

func (x *Hex) UnmarshalJSON(b []byte) error

type ReceivePackRequest

type ReceivePackRequest struct {
	Updates    map[string]*Update `json:"updates"`
	TableHaves []*Hex             `json:"tableHaves,omitempty"`
}

type ReceivePackResponse

type ReceivePackResponse struct {
	Updates   map[string]*Update `json:"updates"`
	TableACKs []*Hex             `json:"tableACKs,omitempty"`
}

type RowDiff

type RowDiff struct {
	Offset1 *uint32 `json:"off1,omitempty"`
	Offset2 *uint32 `json:"off2,omitempty"`
}

type Table

type Table struct {
	Sum       *Hex     `json:"sum,omitempty"`
	Columns   []string `json:"columns,omitempty"`
	PK        []uint32 `json:"pk,omitempty"`
	RowsCount uint32   `json:"rowsCount,omitempty"`
	Exist     bool     `json:"exist"`
}

type TxBranch added in v0.10.1

type TxBranch struct {
	Name       string `json:"name"`
	CurrentSum string `json:"currentSum,omitempty"`
	NewSum     string `json:"newSum"`
}

type Update

type Update struct {
	Sum    *Hex   `json:"sum,omitempty"`
	OldSum *Hex   `json:"oldSum,omitempty"`
	ErrMsg string `json:"errMsg,omitempty"`
}

type UpdateTransactionRequest added in v0.10.1

type UpdateTransactionRequest struct {
	Discard bool `json:"discard,omitempty"`
	Commit  bool `json:"commit,omitempty"`
}

type UploadPackRequest

type UploadPackRequest struct {
	// Wants is the list of wanted commits. Unless Depth is also specified, all
	// ancestors of Wants that are not present on the client will also be sent.
	// In an /upload-pack/ session, Wants must not be empty in the first request
	// and be empty in subsequent requests.
	Wants []*Hex `json:"wants,omitempty"`

	// Haves is the list of non-partial commits present on the client. The server
	// look at this list to figure out the minimal set of commits to send. By
	// default each request has a maximum of 32 haves.
	Haves []*Hex `json:"haves,omitempty"`

	// Depth is the maximum depth pass which the commits will only be transfered
	// shallowly rather than in full. A shallow commit transfer excludes its table
	// so while the commit history is still available, you won't be able to access
	// their data until you have pulled such commits in full. A Depth of 0 means
	// all missing commits will be transfered in full
	Depth int `json:"depth,omitempty"`

	// Done when set to true, signifies that the client is done with negotiation
	// and would like to receive all the commits that the server thinks are missing
	// on the client side. Done is typically set to true when the client has already
	// exhausted its history or has sent 256 haves and still not done with negotiation
	Done bool `json:"done,omitempty"`

	// TableACKs is the list of tables present on both the client and the server. The
	// server will not send tables in this list.
	TableACKs []*Hex `json:"tableACKs,omitempty"`
}

UploadPackRequest is a request to the /upload-pack/ endpoint

type UploadPackResponse

type UploadPackResponse struct {
	// ACKs is the list of commits that are present (but not necessarily in full) on the
	// server. The client can safely remove these commits and their ancestors from
	// negotiation.
	ACKs []*Hex `json:"acks,omitempty"`

	// TableHaves is the list of tables present on the server. The client put one entry
	// for each table that it haves in tableACKs in the next request
	TableHaves []*Hex `json:"tableHaves,omitempty"`
}

UploadPackResponse is a possible response from the /upload-pack/ endpoint. It's primary purpose is to let the client know which commits the server acknowledge is present and to nudge the client to continue negotiation. When negotiation is finished, the server will send a Packfile with all the missing objects instead.

Jump to

Keyboard shortcuts

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