Documentation ¶
Index ¶
- type Acronymbase
- type Contentbase
- func (cb *Contentbase) Insert(lines ...types.ContentLine) error
- func (cb *Contentbase) Len(id types.StoreID) (count int64, err error)
- func (cb *Contentbase) RegexSearchFile(regex string, id types.StoreID, start int, end int) ([]types.ContentLine, error)
- func (cb *Contentbase) Slice(id types.StoreID, start int, end int) ([]types.ContentLine, error)
- type Database
- func (d *Database) Acronym() database.Acronymbase
- func (d *Database) Close(ctx context.Context) error
- func (d *Database) Connect(ctx context.Context) (database.Database, error)
- func (d *Database) Content() database.Contentbase
- func (d *Database) File() database.Filebase
- func (d *Database) GetContext() context.Context
- func (d *Database) Init(ctx context.Context, reset bool) error
- func (d *Database) Owner() database.Ownerbase
- func (d *Database) Store() database.Storebase
- func (d *Database) Tag() database.Tagbase
- func (d *Database) View() database.Viewbase
- type Filebase
- func (fb *Filebase) Count(uid types.OwnerID, pkeys ...string) (int64, error)
- func (fb *Filebase) Get(fid types.FileID) (types.FileI, error)
- func (fb *Filebase) GetAll(fids ...types.FileID) ([]types.FileI, error)
- func (fb *Filebase) GetOwned(uid types.OwnerID) ([]types.FileI, error)
- func (fb *Filebase) GetPermKey(uid types.OwnerID, pkey string) ([]types.FileI, error)
- func (fb *Filebase) Insert(r types.FileI) error
- func (fb *Filebase) MatchStore(oid types.OwnerID, sid []types.StoreID, pkeys ...string) ([]types.FileI, error)
- func (fb *Filebase) Remove(r types.FileID) error
- func (fb *Filebase) Reserve(id types.FileID) (types.FileID, error)
- func (fb *Filebase) Update(r types.FileI) error
- type Ownerbase
- func (ob *Ownerbase) CheckResetKey(keystr string) (id types.OwnerID, err error)
- func (ob *Ownerbase) DeleteResetKey(id types.OwnerID) error
- func (ob *Ownerbase) FindGroupName(name string) (types.GroupI, error)
- func (ob *Ownerbase) FindUserName(name string) (types.UserI, error)
- func (ob *Ownerbase) Get(id types.OwnerID) (types.Owner, error)
- func (ob *Ownerbase) GetGroups(id types.OwnerID) (owned []types.GroupI, member []types.GroupI, err error)
- func (ob *Ownerbase) GetResetKey(id types.OwnerID) (key string, err error)
- func (ob *Ownerbase) GetSpace(id types.OwnerID) (int64, error)
- func (ob *Ownerbase) GetTotalSpace(id types.OwnerID) (int64, error)
- func (ob *Ownerbase) Insert(u types.Owner) (err error)
- func (ob *Ownerbase) Reserve(id types.OwnerID, name string) (oid types.OwnerID, err error)
- func (ob *Ownerbase) Update(u types.Owner) (err error)
- type Storebase
- func (db *Storebase) Get(id types.StoreID) (out *types.FileStore, err error)
- func (db *Storebase) Insert(fs *types.FileStore) error
- func (db *Storebase) MatchHash(h uint32) (out []*types.FileStore, err error)
- func (db *Storebase) Reserve(id types.StoreID) (types.StoreID, error)
- func (db *Storebase) UpdateMeta(fs *types.FileStore) error
- type Tagbase
- func (tb *Tagbase) Get(fid types.FileID, oid types.OwnerID) ([]tag.FileTag, error)
- func (tb *Tagbase) GetAll(typ tag.Type, oid types.OwnerID) ([]tag.FileTag, error)
- func (tb *Tagbase) GetType(fid types.FileID, oid types.OwnerID, typ tag.Type) ([]tag.FileTag, error)
- func (tb *Tagbase) Remove(tags ...tag.FileTag) error
- func (tb *Tagbase) SearchAccess(oid types.OwnerID, pkey string, tags ...tag.FileTag) ([]types.FileID, error)
- func (tb *Tagbase) SearchFiles(fids []types.FileID, tags ...tag.FileTag) ([]types.FileID, error)
- func (tb *Tagbase) SearchOwned(oid types.OwnerID, tags ...tag.FileTag) ([]types.FileID, error)
- func (tb *Tagbase) Upsert(tags ...tag.FileTag) error
- type Viewbase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acronymbase ¶
type Acronymbase struct {
Database
}
Acronymbase is an active connection to the database and operations on acronyms
func (*Acronymbase) Get ¶
func (ab *Acronymbase) Get(a string) ([]string, error)
Get returns all associated phrases for an acronym
func (*Acronymbase) Put ¶
func (ab *Acronymbase) Put(a, c string) error
Put adds an association with an acronym and a phrase
type Contentbase ¶
type Contentbase struct {
Database
}
Contentbase database connection with content lines operations
func (*Contentbase) Insert ¶
func (cb *Contentbase) Insert(lines ...types.ContentLine) error
Insert adds lines to the database
func (*Contentbase) Len ¶
func (cb *Contentbase) Len(id types.StoreID) (count int64, err error)
Len returns number of lines associated with StoreID
func (*Contentbase) RegexSearchFile ¶
func (cb *Contentbase) RegexSearchFile(regex string, id types.StoreID, start int, end int) ([]types.ContentLine, error)
RegexSearchFile returns lines associated with StoreID, within bounds, and matches regular expression
func (*Contentbase) Slice ¶
func (cb *Contentbase) Slice(id types.StoreID, start int, end int) ([]types.ContentLine, error)
Slice returns slices associated with StoreID within bounds
type Database ¶
type Database struct { URI string `json:"uri"` DBName string `json:"db"` CollNames map[string]string `json:"coll"` // contains filtered or unexported fields }
Database implements database.Database for mongodb
func (*Database) Acronym ¶
func (d *Database) Acronym() database.Acronymbase
Acronym opens a new connection to the database if provided a context and returns Acronymbase type if provided context is nil it will reuse the existing connection
func (*Database) Close ¶
Close stops the active connection necessary or else there can be memory leak from unclosed connections
func (*Database) Content ¶
func (d *Database) Content() database.Contentbase
Content opens a new connection to the database if provided a context and returns Contentbase type if provided context is nil it will reuse the existing connection
func (*Database) File ¶
File opens a new connection to the database if provided a context and returns Filebase type if provided context is nil it will reuse the existing connection
func (*Database) GetContext ¶
GetContext returns context of the current open connection
func (*Database) Init ¶
Init tests the connection to the database if reset is true, empties out the databases and sets up indexex
func (*Database) Owner ¶
Owner opens a new connection to the database if provided a context and returns Ownerbase type if provided context is nil the resulting Ownerbase will reuse the existing connection
func (*Database) Store ¶
Store opens a new connection to the database if provided a context and returns Storebase type if provided context is nil it will reuse the existing connection
type Filebase ¶
type Filebase struct {
Database
}
Filebase is a database connection with file operations
func (*Filebase) Count ¶
Count returns the total number of files accessible by the ownerid, the optional pkeys are permission values to check in addition to ownership
func (*Filebase) GetPermKey ¶
GetPermKey returns all files that have owner id with provided permission
func (*Filebase) Insert ¶
Insert file into database. file id must all ready been reserved, see Reserve
func (*Filebase) MatchStore ¶
func (fb *Filebase) MatchStore(oid types.OwnerID, sid []types.StoreID, pkeys ...string) ([]types.FileI, error)
MatchStore returns all files where an owner either owns the file or has a particular permission, and the file matches one of the provided StoreIDs
type Ownerbase ¶
type Ownerbase struct {
Database
}
Ownerbase is a connection to the databae with owner operations
func (*Ownerbase) CheckResetKey ¶
CheckResetKey looks up a reset key and which owner is associated with that key
func (*Ownerbase) DeleteResetKey ¶
DeleteResetKey deletes resetkey pairing to owner id
func (*Ownerbase) FindGroupName ¶
FindGroupName finds group based on name
func (*Ownerbase) FindUserName ¶
FindUserName returns user based on username
func (*Ownerbase) GetGroups ¶
func (ob *Ownerbase) GetGroups(id types.OwnerID) (owned []types.GroupI, member []types.GroupI, err error)
GetGroups returns owned groups and groups an owner is a member of. based on the id of the owner
func (*Ownerbase) GetResetKey ¶
GetResetKey generates a password reset key
func (*Ownerbase) GetTotalSpace ¶
GetTotalSpace returns the amount of total space available to an owner
func (*Ownerbase) Insert ¶
Insert adds owner to the database, owner id must first be reserved, see Reserve
type Storebase ¶
type Storebase struct {
Database
}
Storebase is a connection to the database with file store operations
type Tagbase ¶
type Tagbase struct {
Database
}
Tagbase is a connection to the database with tag operations
func (*Tagbase) GetAll ¶
GetAll returns all FileTags that have a particular type and and owner. Since it looks for owner association, store tags are not searched
func (*Tagbase) GetType ¶
func (tb *Tagbase) GetType(fid types.FileID, oid types.OwnerID, typ tag.Type) ([]tag.FileTag, error)
GetType returns FileTags of a particular file, for a particular owner, with a match to a particular type
func (*Tagbase) SearchAccess ¶
func (tb *Tagbase) SearchAccess(oid types.OwnerID, pkey string, tags ...tag.FileTag) ([]types.FileID, error)
SearchAccess returns all fileids that the owner has access to in a particular permission and match the filtering tags
func (*Tagbase) SearchFiles ¶
SearchFiles returns all the fileids that match the tags which define the filter conditions
func (*Tagbase) SearchOwned ¶
SearchOwned returns all fileids that are owned by the owner and match the filtering tags