Documentation ¶
Overview ¶
Package consyn implements E2's config handler and file store
Index ¶
- Variables
- type Object
- func (object *Object) AllowsType(objectType ObjectType) bool
- func (object *Object) Bool() (bool, error)
- func (object *Object) Created() bool
- func (object *Object) Delete()
- func (object *Object) Deleted() bool
- func (object *Object) Float() (float64, error)
- func (object *Object) Int() (int, error)
- func (object *Object) Modified() bool
- func (object *Object) Raw() ([]byte, error)
- func (object *Object) SetBool(b bool) error
- func (object *Object) SetFloat(f float64) error
- func (object *Object) SetInt(i int) error
- func (object *Object) SetRaw(raw []byte) error
- func (object *Object) SetString(s string) error
- func (object *Object) String() (string, error)
- type ObjectType
- type Store
- func (store *Store) DeleteAndSync() error
- func (store *Store) NewObject(path string, objectType ObjectType) (*Object, error)
- func (store *Store) Object(path string) (*Object, error)
- func (store *Store) ReadZip(zipPath string) error
- func (store *Store) Sync() (err error)
- func (store *Store) SyncObject(path string) error
- func (store *Store) WriteZip(zipPath string) error
Constants ¶
This section is empty.
Variables ¶
var ( DirPerms = 0755 FilePerms = 0644 )
var ( ErrObjectAlreadyExists = errors.New("object already exists at given path") ErrObjectDoesNotExist = errors.New("object with given path does not exist") ErrInvalidObjectType = errors.New("object type is invalid") ErrObjectDeleted = errors.New("object has been marked for deletion") ErrInvalidPath = errors.New("object path is not valid") )
Functions ¶
This section is empty.
Types ¶
type Object ¶
type Object struct { Type ObjectType // contains filtered or unexported fields }
func (*Object) AllowsType ¶
func (object *Object) AllowsType(objectType ObjectType) bool
AllowsType returns true if object allows values with the given ObjectType to be stored.
func (*Object) Created ¶
Created returns true if object has recently been created, but has not yet been synced.
func (*Object) Delete ¶
func (object *Object) Delete()
Delete marks an object for deletion on next sync and makes the contents inaccessible.
func (*Object) Modified ¶
Modified returns true if object has recently been modified, but has not yet been synced.
type ObjectType ¶
type ObjectType uint
const ( ObjectTypeString ObjectType = 1 << iota ObjectTypeBool ObjectTypeInt ObjectTypeFloat ObjectTypeAny = ^ObjectType(0) )
type Store ¶
type Store struct { IgnoreFSChanges bool // contains filtered or unexported fields }
func NewTempStore ¶
NewTempStore created a new consyn Store in a temporary directory, with the given name as a prefix.
func (*Store) DeleteAndSync ¶
DeleteAndSync deletes all the objects in the store and runs (*Store).Sync().
func (*Store) NewObject ¶
func (store *Store) NewObject(path string, objectType ObjectType) (*Object, error)
NewObject creates a new Object in the current Store.
func (*Store) SyncObject ¶
SyncObject syncs the Object at the specified path with the disk.