{"modulePath":"github.com/RedAFD/code-core","version":"v1.8.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lfs\n\n## Functions\n\n```go\nfunc BatchHandler(ctx *context.Context)\n```\nBatchHandler provides the batch api\n\n```go\nfunc ContentMatcher(r macaron.Request) bool\n```\nContentMatcher provides a mux.MatcherFunc that only allows requests that contain an Accept header with the contentMediaType\n\n```go\nfunc GetListLockHandler(ctx *context.Context)\n```\nGetListLockHandler list locks\n\n```go\nfunc IsPointerFile(buf *[]byte) *models.LFSMetaObject\n```\nIsPointerFile will return a partially filled LFSMetaObject if the provided byte slice is a pointer file\n\n```go\nfunc MetaMatcher(r macaron.Request) bool\n```\nMetaMatcher provides a mux.MatcherFunc that only allows requests that contain an Accept header with the metaMediaType\n\n```go\nfunc ObjectOidHandler(ctx *context.Context)\n```\nObjectOidHandler is the main request routing entry point into LFS server functions\n\n```go\nfunc PostHandler(ctx *context.Context)\n```\nPostHandler instructs the client how to upload data\n\n```go\nfunc PostLockHandler(ctx *context.Context)\n```\nPostLockHandler create lock\n\n```go\nfunc PutHandler(ctx *context.Context)\n```\nPutHandler receives data from the client and puts it into the content store\n\n```go\nfunc ReadMetaObject(meta *models.LFSMetaObject) (io.ReadCloser, error)\n```\nReadMetaObject will read a models.LFSMetaObject and return a reader\n\n```go\nfunc ReadPointerFile(reader io.Reader) (*models.LFSMetaObject, *[]byte)\n```\nReadPointerFile will return a partially filled LFSMetaObject if the provided reader is a pointer file\n\n```go\nfunc UnLockHandler(ctx *context.Context)\n```\nUnLockHandler delete locks\n\n```go\nfunc VerifyHandler(ctx *context.Context)\n```\nVerifyHandler verify oid and its size from the content store\n\n```go\nfunc VerifyLockHandler(ctx *context.Context)\n```\nVerifyLockHandler list locks for verification\n\n## Types\n\n```go\ntype BatchResponse struct {\n\tTransfer string            `json:\"transfer,omitempty\"`\n\tObjects  []*Representation `json:\"objects\"`\n}\n```\nBatchResponse contains multiple object metadata Representation structures for use with the batch API.\n\n```go\ntype BatchVars struct {\n\tTransfers []string       `json:\"transfers,omitempty\"`\n\tOperation string         `json:\"operation\"`\n\tObjects   []*RequestVars `json:\"objects\"`\n}\n```\nBatchVars contains multiple RequestVars processed in one batch operation. [https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md](https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md)\n\n```go\ntype ContentStore struct {\n\tBasePath string\n}\n```\nContentStore provides a simple file system based storage.\n\n```go\nfunc (s *ContentStore) Exists(meta *models.LFSMetaObject) bool\n```\nExists returns true if the object exists in the content store.\n\n```go\nfunc (s *ContentStore) Get(meta *models.LFSMetaObject, fromByte int64) (io.ReadCloser, error)\n```\nGet takes a Meta object and retrieves the content from the store, returning it as an io.Reader. If fromByte \u003e 0, the reader starts from that byte\n\n```go\nfunc (s *ContentStore) Put(meta *models.LFSMetaObject, r io.Reader) error\n```\nPut takes a Meta object and an io.Reader and writes the content to the store.\n\n```go\nfunc (s *ContentStore) Verify(meta *models.LFSMetaObject) (bool, error)\n```\nVerify returns true if the object exists in the content store and size is correct.\n\n```go\ntype ObjectError struct {\n\tCode    int    `json:\"code\"`\n\tMessage string `json:\"message\"`\n}\n```\nObjectError defines the JSON structure returned to the client in case of an error\n\n```go\ntype Representation struct {\n\tOid     string           `json:\"oid\"`\n\tSize    int64            `json:\"size\"`\n\tActions map[string]*link `json:\"actions\"`\n\tError   *ObjectError     `json:\"error,omitempty\"`\n}\n```\nRepresentation is object metadata as seen by clients of the lfs server.\n\n```go\nfunc Represent(rv *RequestVars, meta *models.LFSMetaObject, download, upload bool) *Representation\n```\nRepresent takes a RequestVars and Meta and turns it into a Representation suitable for json encoding\n\n```go\ntype RequestVars struct {\n\tOid           string\n\tSize          int64\n\tUser          string\n\tPassword      string\n\tRepo          string\n\tAuthorization string\n}\n```\nRequestVars contain variables from the HTTP request. Variables from routing, json body decoding, and some headers are stored.\n\n```go\nfunc (v *RequestVars) ObjectLink() string\n```\nObjectLink builds a URL linking to the object.\n\n```go\nfunc (v *RequestVars) VerifyLink() string\n```\nVerifyLink builds a URL for verifying the object.\n\n","path":"github.com/RedAFD/code-core/modules/lfs","name":"lfs","synopsis":"","isRedistributable":true}
