Documentation
¶
Index ¶
- func ContentMatcher(r *http.Request, m *mux.RouteMatch) bool
- func MetaMatcher(r *http.Request, m *mux.RouteMatch) bool
- type BatchResponse
- type BatchVars
- type ContentStore
- type Lock
- type LockList
- type LockRequest
- type LockResponse
- type LocksByCreatedAt
- type MetaObject
- type MetaStore
- func (s *MetaStore) AddLocks(repo string, l ...Lock) error
- func (s *MetaStore) AllLocks() ([]Lock, error)
- func (s *MetaStore) Close()
- func (s *MetaStore) Delete(v *RequestVars) error
- func (s *MetaStore) DeleteLock(repo, user, id string, force bool) (*Lock, error)
- func (s *MetaStore) FilteredLocks(repo, path, cursor, limit string) (locks []Lock, next string, err error)
- func (s *MetaStore) Get(v *RequestVars) (*MetaObject, error)
- func (s *MetaStore) Locks(repo string) ([]Lock, error)
- func (s *MetaStore) Objects() ([]*MetaObject, error)
- func (s *MetaStore) Put(v *RequestVars) (*MetaObject, error)
- func (s *MetaStore) UnsafeGet(v *RequestVars) (*MetaObject, error)
- type ObjectError
- type Representation
- type RequestVars
- type Server
- func (s *Server) BatchHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) CreateLockHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteLockHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetContentHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetMetaHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) LocksHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) LocksVerifyHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) PostHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) PutHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) Represent(rv *RequestVars, meta *MetaObject, url string, download, upload bool) *Representation
- func (s *Server) VerifyHandler(w http.ResponseWriter, r *http.Request)
- type UnlockRequest
- type UnlockResponse
- type User
- type VerifiableLockList
- type VerifiableLockRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentMatcher ¶
func ContentMatcher(r *http.Request, m *mux.RouteMatch) bool
ContentMatcher provides a mux.MatcherFunc that only allows requests that contain an Accept header with the contentMediaType
func MetaMatcher ¶
func MetaMatcher(r *http.Request, m *mux.RouteMatch) bool
MetaMatcher provides a mux.MatcherFunc that only allows requests that contain an Accept header with the metaMediaType
Types ¶
type BatchResponse ¶
type BatchResponse struct { Transfer string `json:"transfer,omitempty"` Objects []*Representation `json:"objects"` }
type BatchVars ¶
type BatchVars struct { Transfers []string `json:"transfers,omitempty"` Operation string `json:"operation"` Objects []*RequestVars `json:"objects"` }
type ContentStore ¶
type ContentStore struct {
// contains filtered or unexported fields
}
ContentStore provides a simple file system based storage.
func NewContentStore ¶
func NewContentStore(base string) (*ContentStore, error)
NewContentStore creates a ContentStore at the base directory.
func (*ContentStore) Exists ¶
func (s *ContentStore) Exists(meta *MetaObject) bool
Exists returns true if the object exists in the content store.
func (*ContentStore) Get ¶
func (s *ContentStore) Get(meta *MetaObject, fromByte int64) (io.ReadCloser, error)
Get takes a Meta object and retreives the content from the store, returning it as an io.ReaderCloser. If fromByte > 0, the reader starts from that byte
func (*ContentStore) Put ¶
func (s *ContentStore) Put(meta *MetaObject, r io.Reader) error
Put takes a Meta object and an io.Reader and writes the content to the store.
type LockRequest ¶
type LockRequest struct {
Path string `json:"path"`
}
type LockResponse ¶
type LocksByCreatedAt ¶
type LocksByCreatedAt []Lock
func (LocksByCreatedAt) Len ¶
func (c LocksByCreatedAt) Len() int
func (LocksByCreatedAt) Less ¶
func (c LocksByCreatedAt) Less(i, j int) bool
func (LocksByCreatedAt) Swap ¶
func (c LocksByCreatedAt) Swap(i, j int)
type MetaObject ¶
MetaObject is object metadata as seen by the object and metadata stores.
type MetaStore ¶
type MetaStore struct {
// contains filtered or unexported fields
}
MetaStore implements a metadata storage. It stores user credentials and Meta information for objects. The storage is handled by boltdb.
func NewMetaStore ¶
NewMetaStore creates a new MetaStore using the boltdb database at dbFile.
func (*MetaStore) AllLocks ¶
AllLocks return all locks in the store, lock path is prepended with repo
func (*MetaStore) Delete ¶
func (s *MetaStore) Delete(v *RequestVars) error
Delete removes the meta information from RequestVars to the store.
func (*MetaStore) DeleteLock ¶
DeleteLock removes lock for the repo by id from the store
func (*MetaStore) FilteredLocks ¶
func (s *MetaStore) FilteredLocks(repo, path, cursor, limit string) (locks []Lock, next string, err error)
FilteredLocks return filtered locks for the repo
func (*MetaStore) Get ¶
func (s *MetaStore) Get(v *RequestVars) (*MetaObject, error)
Get retrieves the Meta information for an object given information in RequestVars
func (*MetaStore) Objects ¶
func (s *MetaStore) Objects() ([]*MetaObject, error)
Objects returns all MetaObjects in the meta store
func (*MetaStore) Put ¶
func (s *MetaStore) Put(v *RequestVars) (*MetaObject, error)
Put writes meta information from RequestVars to the store.
func (*MetaStore) UnsafeGet ¶
func (s *MetaStore) UnsafeGet(v *RequestVars) (*MetaObject, error)
Get retrieves the Meta information for an object given information in RequestVars DO NOT CHECK authentication, as it is supposed to have been done before
type ObjectError ¶
type Representation ¶
type Representation struct { Oid string `json:"oid"` Size int64 `json:"size"` Actions map[string]*link `json:"actions"` Error *ObjectError `json:"error,omitempty"` }
Representation is object medata as seen by clients of the lfs server.
type RequestVars ¶
RequestVars contain variables from the HTTP request. Variables from routing, json body decoding, and some headers are stored.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server links ContentStore, and MetaStore to provide the LFS server.
func NewServer ¶
func NewServer(content *ContentStore, meta *MetaStore) *Server
NewServer creates a new App using the ContentStore and MetaStore provided
func (*Server) BatchHandler ¶
func (s *Server) BatchHandler(w http.ResponseWriter, r *http.Request)
func (*Server) CreateLockHandler ¶
func (s *Server) CreateLockHandler(w http.ResponseWriter, r *http.Request)
func (*Server) DeleteLockHandler ¶
func (s *Server) DeleteLockHandler(w http.ResponseWriter, r *http.Request)
func (*Server) GetContentHandler ¶
func (s *Server) GetContentHandler(w http.ResponseWriter, r *http.Request)
func (*Server) GetMetaHandler ¶
func (s *Server) GetMetaHandler(w http.ResponseWriter, r *http.Request)
func (*Server) LocksHandler ¶
func (s *Server) LocksHandler(w http.ResponseWriter, r *http.Request)
func (*Server) LocksVerifyHandler ¶
func (s *Server) LocksVerifyHandler(w http.ResponseWriter, r *http.Request)
func (*Server) PostHandler ¶
func (s *Server) PostHandler(w http.ResponseWriter, r *http.Request)
func (*Server) PutHandler ¶
func (s *Server) PutHandler(w http.ResponseWriter, r *http.Request)
func (*Server) Represent ¶
func (s *Server) Represent(rv *RequestVars, meta *MetaObject, url string, download, upload bool) *Representation
func (*Server) VerifyHandler ¶
func (s *Server) VerifyHandler(w http.ResponseWriter, r *http.Request)
type UnlockRequest ¶
type UnlockRequest struct {
Force bool `json:"force"`
}