Documentation
¶
Overview ¶
Package api holds the wire types and error codes of the /v1 routes.
Index ¶
- type Blobs
- type BlobsRequest
- type ClaimRequest
- type ClaimResponse
- type Code
- type Commit
- type CreateRepoRequest
- type CreateRepoResponse
- type Error
- type ErrorBody
- type FlushRequest
- type Has
- type HasRequest
- type ImportPackRequest
- type Object
- type OpHeads
- type OpObject
- type PutObjectsRequest
- type PutObjectsResponse
- type Ref
- type Refs
- type Repo
- type Repos
- type SetWorkspaceRequest
- type SwapOpHeadsRequest
- type SwapRefRequest
- type Tree
- type TreeEntry
- type Trees
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlobsRequest ¶
type BlobsRequest struct {
SHAs []string `json:"shas"`
}
type ClaimRequest ¶
type ClaimRequest struct {
Epoch uint64 `json:"epoch"`
Owner string `json:"owner"`
Repo string `json:"repo"`
}
ClaimRequest is the body of PUT /v1/workspaces/{id}/claim.
type ClaimResponse ¶
type ClaimResponse struct {
Epoch uint64 `json:"epoch"`
Op string `json:"op"`
Snapshot string `json:"snapshot"`
}
ClaimResponse returns the stored epoch, op and snapshot of the workspace.
type Code ¶
type Code string
Code is a wire error code.
const ( CodeNotConfigured Code = "vcs_not_configured" CodeNotFound Code = "vcs_not_found" CodeGenerationConflict Code = "vcs_generation_conflict" CodeClaimLost Code = "vcs_claim_lost" CodeObjectInvalid Code = "vcs_object_invalid" CodeObjectTooLarge Code = "vcs_object_too_large" CodeRepoForbidden Code = "vcs_repo_forbidden" CodeWorkspaceConflict Code = "vcs_workspace_conflict" CodeWorkspaceDeleted Code = "vcs_workspace_deleted" CodeInvalidBody Code = "invalid_body" CodeInternal Code = "internal_error" )
type CreateRepoRequest ¶
CreateRepoRequest is the body of POST /v1/repos.
type CreateRepoResponse ¶
type CreateRepoResponse struct {
Path string `json:"path"`
}
type Error ¶
type ErrorBody ¶
type ErrorBody struct {
Error Error `json:"error"`
}
ErrorBody is the body of every error response. A conflict on a ref sets Details["ref"] to the stored Ref.
type FlushRequest ¶
type FlushRequest struct {
Epoch uint64 `json:"epoch"`
Generation int64 `json:"generation"`
Prev string `json:"prev"`
Op string `json:"op"`
Snapshot string `json:"snapshot"`
}
FlushRequest is the body of POST /v1/workspaces/{id}/flush.
type HasRequest ¶
type HasRequest struct {
SHAs []string `json:"shas"`
}
type ImportPackRequest ¶
ImportPackRequest is the body of PUT /v1/vcs/packs/{pack_id}. The pack ID is the lowercase hex SHA-256 of the pack bytes. Both fields are base64.
type OpHeads ¶
type OpHeads struct {
Epoch uint64 `json:"epoch"`
Generation int64 `json:"generation"`
Heads []string `json:"heads"`
}
OpHeads is the head set of the op log of a workspace. Generation starts at 1.
type PutObjectsRequest ¶
type PutObjectsRequest struct {
Objects []Object `json:"objects"`
}
type PutObjectsResponse ¶
type PutObjectsResponse struct {
SHAs []string `json:"shas"`
}
type Ref ¶
type Ref struct {
Name string `json:"name"`
Commit string `json:"commit"`
Generation int64 `json:"generation"`
}
Ref is one ref of a repository. Commit is 40 lowercase hex digits. Generation is never reused, even when the ref is deleted and created again.
type Repo ¶
type Repo struct {
Path string `json:"path"`
Name string `json:"name"`
Owner string `json:"owner"`
CreatedAt string `json:"created_at"`
}
Repo is one repository of the store.
type SetWorkspaceRequest ¶
type SetWorkspaceRequest struct {
Op string `json:"op"`
Commit string `json:"commit"`
Generation int64 `json:"generation"`
}
SetWorkspaceRequest is the body of PUT /v1/vcs/workspace. Generation is that of the op-heads swap of Op.
type SwapOpHeadsRequest ¶
type SwapOpHeadsRequest struct {
ExpectGeneration int64 `json:"expect_generation"`
Heads []string `json:"heads"`
}
SwapOpHeadsRequest is the body of PUT /v1/vcs/op-heads. ExpectGeneration is 0 for the first write.
type SwapRefRequest ¶
SwapRefRequest is the body of PUT /v1/vcs/refs/{name}. Expect is the stored generation, or 0 to create the ref.