Documentation ¶
Index ¶
- Constants
- Variables
- type AppContext
- func (c *AppContext) Authenticate(w http.ResponseWriter, r *http.Request) (*Credentials, bool)
- func (c *AppContext) DeleteCollectionObjectsHandler(w http.ResponseWriter, r *http.Request)
- func (c *AppContext) DeleteObjectHandler(w http.ResponseWriter, r *http.Request)
- func (c *AppContext) DeleteStorageHandler(w http.ResponseWriter, r *http.Request)
- func (c *AppContext) GetObjectHandler(w http.ResponseWriter, r *http.Request)
- func (c *AppContext) GetObjectsHandler(w http.ResponseWriter, r *http.Request)
- func (c *AppContext) InfoCollectionCountsHandler(w http.ResponseWriter, r *http.Request)
- func (c *AppContext) InfoCollectionsHandler(w http.ResponseWriter, r *http.Request)
- func (c *AppContext) PostObjectsHandler(w http.ResponseWriter, r *http.Request)
- func (c *AppContext) PutObjectHandler(w http.ResponseWriter, r *http.Request)
- type CollectionInfo
- type Config
- type Credentials
- type CredentialsStore
- type DatabaseSession
- func (session *DatabaseSession) Close()
- func (ds *DatabaseSession) DeleteCollectionObjects(userId uint64, collectionName string) error
- func (ds *DatabaseSession) DeleteUserObjects(userId uint64) error
- func (ds *DatabaseSession) GetCollectionTimestamps(uid uint64) (map[string]float64, error)
- func (ds *DatabaseSession) GetObject(userId uint64, collectionName string, objectId string) (*Object, error)
- func (ds *DatabaseSession) GetObjectIds(userId uint64, limit int, newer float64) ([]string, error)
- func (ds *DatabaseSession) GetObjects(userId uint64, collectionName string, limit int, newer float64) ([]Object, error)
- func (ds *DatabaseSession) PutObject(userId uint64, collectionName string, objectId string, object Object) (float64, error)
- func (ds *DatabaseSession) SetObjects(userId uint64, collectionName string, objects []Object) (float64, error)
- type DeleteCollectionObjectsResponse
- type GetObjectsOptions
- type Object
- type ObjectDatabase
- func (odb *ObjectDatabase) Close() error
- func (odb *ObjectDatabase) DeleteCollection(collectionName string) (float64, error)
- func (odb *ObjectDatabase) DeleteObject(collectionName, objectId string) error
- func (odb *ObjectDatabase) DeleteObjects(collectionName string, objectIds []string) (float64, error)
- func (odb *ObjectDatabase) DeleteStorage() error
- func (odb *ObjectDatabase) GetCollectionCounts() (map[string]int, error)
- func (odb *ObjectDatabase) GetCollectionsInfo() (map[string]CollectionInfo, error)
- func (odb *ObjectDatabase) GetObject(collectionName, objectId string) (Object, error)
- func (odb *ObjectDatabase) GetObjectIds(collectionName string, options *GetObjectsOptions) ([]string, error)
- func (odb *ObjectDatabase) GetObjects(collectionName string, options *GetObjectsOptions) ([]Object, error)
- func (odb *ObjectDatabase) PutObject(collectionName string, object Object) (Object, error)
- func (odb *ObjectDatabase) PutObjects(collectionName string, objects []Object) (float64, error)
- type PostObjectsResponse
Constants ¶
View Source
const ( DEFAULT_DATABASE_ROOT_PATH = "/tmp/storageserver" DEFAULT_SHARED_SECRET = "cheesebaconeggs" )
View Source
const MAX_LIMIT = 5000
Variables ¶
View Source
var CollectionNotFoundErr = errors.New("Collection not found")
View Source
var IterationCancelledErr = errors.New("Iteration cancelled")
View Source
var ObjectNotFoundErr = errors.New("Object not found")
Functions ¶
This section is empty.
Types ¶
type AppContext ¶
type AppContext struct {
// contains filtered or unexported fields
}
func SetupRouter ¶
func SetupRouter(r *mux.Router, config Config) (*AppContext, error)
func (*AppContext) Authenticate ¶
func (c *AppContext) Authenticate(w http.ResponseWriter, r *http.Request) (*Credentials, bool)
func (*AppContext) DeleteCollectionObjectsHandler ¶
func (c *AppContext) DeleteCollectionObjectsHandler(w http.ResponseWriter, r *http.Request)
func (*AppContext) DeleteObjectHandler ¶
func (c *AppContext) DeleteObjectHandler(w http.ResponseWriter, r *http.Request)
func (*AppContext) DeleteStorageHandler ¶
func (c *AppContext) DeleteStorageHandler(w http.ResponseWriter, r *http.Request)
func (*AppContext) GetObjectHandler ¶
func (c *AppContext) GetObjectHandler(w http.ResponseWriter, r *http.Request)
func (*AppContext) GetObjectsHandler ¶
func (c *AppContext) GetObjectsHandler(w http.ResponseWriter, r *http.Request)
func (*AppContext) InfoCollectionCountsHandler ¶
func (c *AppContext) InfoCollectionCountsHandler(w http.ResponseWriter, r *http.Request)
func (*AppContext) InfoCollectionsHandler ¶
func (c *AppContext) InfoCollectionsHandler(w http.ResponseWriter, r *http.Request)
func (*AppContext) PostObjectsHandler ¶
func (c *AppContext) PostObjectsHandler(w http.ResponseWriter, r *http.Request)
func (*AppContext) PutObjectHandler ¶
func (c *AppContext) PutObjectHandler(w http.ResponseWriter, r *http.Request)
type CollectionInfo ¶
type CollectionInfo struct {
LastModified float64
}
type Config ¶
type Config struct { DatabaseRootPath string }
func DefaultConfig ¶
func DefaultConfig() Config
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
func (*Credentials) Key ¶
func (c *Credentials) Key() hawk.Key
type CredentialsStore ¶
type CredentialsStore struct {
// contains filtered or unexported fields
}
func (*CredentialsStore) CredentialsForKeyIdentifier ¶
func (cs *CredentialsStore) CredentialsForKeyIdentifier(keyIdentifier string) (hawk.Credentials, error)
type DatabaseSession ¶
type DatabaseSession struct {
// contains filtered or unexported fields
}
func NewDatabaseSession ¶
func NewDatabaseSession(url string) (*DatabaseSession, error)
func (*DatabaseSession) Close ¶
func (session *DatabaseSession) Close()
func (*DatabaseSession) DeleteCollectionObjects ¶
func (ds *DatabaseSession) DeleteCollectionObjects(userId uint64, collectionName string) error
func (*DatabaseSession) DeleteUserObjects ¶
func (ds *DatabaseSession) DeleteUserObjects(userId uint64) error
func (*DatabaseSession) GetCollectionTimestamps ¶
func (ds *DatabaseSession) GetCollectionTimestamps(uid uint64) (map[string]float64, error)
func (*DatabaseSession) GetObjectIds ¶
TODO: Get rid of this because I don't think it is actually used on any device?
func (*DatabaseSession) GetObjects ¶
func (*DatabaseSession) SetObjects ¶
type DeleteCollectionObjectsResponse ¶
type DeleteCollectionObjectsResponse struct {
Modified float64 `json:"modified"`
}
type GetObjectsOptions ¶
func ParseGetObjectsOptions ¶
func ParseGetObjectsOptions(r *http.Request) (*GetObjectsOptions, error)
type Object ¶
type ObjectDatabase ¶
type ObjectDatabase struct {
// contains filtered or unexported fields
}
func OpenObjectDatabase ¶
func OpenObjectDatabase(path string) (*ObjectDatabase, error)
func (*ObjectDatabase) Close ¶
func (odb *ObjectDatabase) Close() error
func (*ObjectDatabase) DeleteCollection ¶
func (odb *ObjectDatabase) DeleteCollection(collectionName string) (float64, error)
func (*ObjectDatabase) DeleteObject ¶
func (odb *ObjectDatabase) DeleteObject(collectionName, objectId string) error
func (*ObjectDatabase) DeleteObjects ¶
func (odb *ObjectDatabase) DeleteObjects(collectionName string, objectIds []string) (float64, error)
func (*ObjectDatabase) DeleteStorage ¶
func (odb *ObjectDatabase) DeleteStorage() error
func (*ObjectDatabase) GetCollectionCounts ¶
func (odb *ObjectDatabase) GetCollectionCounts() (map[string]int, error)
func (*ObjectDatabase) GetCollectionsInfo ¶
func (odb *ObjectDatabase) GetCollectionsInfo() (map[string]CollectionInfo, error)
func (*ObjectDatabase) GetObject ¶
func (odb *ObjectDatabase) GetObject(collectionName, objectId string) (Object, error)
func (*ObjectDatabase) GetObjectIds ¶
func (odb *ObjectDatabase) GetObjectIds(collectionName string, options *GetObjectsOptions) ([]string, error)
func (*ObjectDatabase) GetObjects ¶
func (odb *ObjectDatabase) GetObjects(collectionName string, options *GetObjectsOptions) ([]Object, error)
func (*ObjectDatabase) PutObject ¶
func (odb *ObjectDatabase) PutObject(collectionName string, object Object) (Object, error)
func (*ObjectDatabase) PutObjects ¶
func (odb *ObjectDatabase) PutObjects(collectionName string, objects []Object) (float64, error)
Click to show internal directories.
Click to hide internal directories.