Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppsIndexes = map[string][]string{
	"slug":        {"slug", "editor", "type"},
	"type":        {"type", "slug", "editor"},
	"editor":      {"editor", "slug", "type"},
	"created_at":  {"created_at", "slug", "editor", "type"},
	"maintenance": {"maintenance_activated"},
}

AppsIndexes is the list of the mango indexes that can be used.

View Source
var Spaces map[string]*Space

Spaces is a global map of name -> space.

Functions

func AppIndexName

func AppIndexName(name string) string

AppIndexName returns the long name of the index.

func CreateVersionsDateView

func CreateVersionsDateView(db *kivik.DB) error

func CreateVersionsViews

func CreateVersionsViews(c *Space, db *kivik.DB, appSlug string) error

func GetSpacesNames

func GetSpacesNames() []string

GetSpacesNames returns the list of the space names.

func InitializeSpaces

func InitializeSpaces() error

InitializeSpaces can be used to initialize again the spaces (ie check that the databases exist, have their indexes, etc.)

func Register

func Register(name string) error

Register adds a space to the Spaces map, and initializes it.

func VersViewDocName

func VersViewDocName(appSlug string) string

Types

type Space

type Space struct {
	Name string
	// contains filtered or unexported fields
}

Space is a way to regroup applications that are available to the same cozy instances. For example, it can make sense to have a space for the self-hosted users, with dedicated apps and konnectors.

func GetSpace

func GetSpace(name string) (*Space, bool)

GetSpace return the space with the given name

func NewSpace

func NewSpace(name string) *Space

NewSpace returns a space with the given name.

func (*Space) AppsDB

func (s *Space) AppsDB() *kivik.DB

AppsDB returns the database used for storing the apps in this space.

func (*Space) Clone

func (s *Space) Clone(name string) Space

Clone takes an optionnal name parameter. If empty, use the original space name.

func (*Space) DBs

func (s *Space) DBs() []*kivik.DB

DBs returns the three databases used by this space.

func (*Space) GetPrefix

func (s *Space) GetPrefix() base.Prefix

GetPrefix returns the prefix for this space.

func (*Space) PendingVersDB

func (s *Space) PendingVersDB() *kivik.DB

PendingVersDB returns the database used for storing the pending versions in this space.

func (*Space) VersDB

func (s *Space) VersDB() *kivik.DB

VersDB returns the database used for storing the published versions in this space.

Source Files