Documentation
¶
Index ¶
- func New() (db.DB, error)
- type ProtoDB
- func (pdb *ProtoDB) DeleteEntity(ID string) error
- func (pdb *ProtoDB) DeleteGroup(name string) error
- func (pdb *ProtoDB) DiscoverEntityIDs() ([]string, error)
- func (pdb *ProtoDB) DiscoverGroupNames() ([]string, error)
- func (pdb *ProtoDB) LoadEntity(ID string) (*pb.Entity, error)
- func (pdb *ProtoDB) LoadEntityNumber(number int32) (*pb.Entity, error)
- func (pdb *ProtoDB) LoadGroup(name string) (*pb.Group, error)
- func (pdb *ProtoDB) LoadGroupNumber(number int32) (*pb.Group, error)
- func (pdb *ProtoDB) SaveEntity(e *pb.Entity) error
- func (pdb *ProtoDB) SaveGroup(g *pb.Group) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a new ProtoDB instance that is initialized and ready for use. This function will attempt to set up the data directory and fail out if it does not have permissions to write/stat the base directory and children. This function will bail out the entire program as without the backing store the functionality of the rest of the server is undefined!
Types ¶
type ProtoDB ¶
type ProtoDB struct {
// contains filtered or unexported fields
}
The ProtoDB type binds all methods that are a part of the protodb package.
func (*ProtoDB) DeleteEntity ¶
DeleteEntity removes an entity from disk. This is rather simple to do given that each entity is owned by exactly one file on disk. Simply removing the file is sufficient to delete the entity.
func (*ProtoDB) DeleteGroup ¶
DeleteGroup removes an entity from disk. This is rather simple to do given that each group is owned by exactly one file on disk. Simply removing the file is sufficient to delete the entity.
func (*ProtoDB) DiscoverEntityIDs ¶
DiscoverEntityIDs returns a list of entity IDs that this loader can retrieve by globbing the entity directory of the data_root. This is not foolproof, but assuming that the data_root is not modified by hand it should be safe enough.
func (*ProtoDB) DiscoverGroupNames ¶
DiscoverGroupNames returns a list of entity IDs that this loader can retrieve by globbing the group directory of the data_root. This is not foolproof, but assuming that the data_root is not modified by hand it should be safe enough.
func (*ProtoDB) LoadEntity ¶
LoadEntity loads a single entity from the data_root given the ID associated with the entity.
func (*ProtoDB) LoadEntityNumber ¶
LoadEntityNumber loads a single entity from the data_root given the number associated with the entity.
func (*ProtoDB) LoadGroup ¶
LoadGroup attempts to load a group by name from the disk. It can fail on proto errors or bogus file permissions reading the file.
func (*ProtoDB) LoadGroupNumber ¶
LoadGroupNumber attempts to load a group by number.
func (*ProtoDB) SaveEntity ¶
SaveEntity writes an entity to disk. Errors may be returned for proto marshal errors or for errors writing to disk. No promises are made regarding if the data has been written to disk at the return of this function as the operatig system may choose to buffer the data until a larger block may be written.
func (*ProtoDB) SaveGroup ¶
SaveGroup writes an entity to disk. Errors may be returned for proto marshal errors or for errors writing to disk. No promises are made regarding if the data has been written to disk at the return of this function as the operatig system may choose to buffer the data until a larger block may be written.