Documentation ¶
Overview ¶
the distributed package contains all the functionality for the distributed mode (learn more about this in the README). This is mainly the reading and writing of the data using as much concurrency as possible.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CustomerToSave ¶
type CustomerToSave struct { Customer schema.Party ProjectFiles ProjectFiles }
CustomerToSave serves as the information source to save all customers and their projects in the repository structure.
type CustomersToSave ¶
type CustomersToSave []CustomerToSave
CustomersToSave is a slice of CustomerToSave's.
type OpenContainer ¶
type OpenContainer struct {
// contains filtered or unexported fields
}
OpenContainer encapsulates all data slices which have to be open in a concurrency-safe manner. Multiple go-routines can add data to the same collection without having to wait.
func (*OpenContainer) AddCst ¶
func (c *OpenContainer) AddCst(cst schema.Party)
AddCst adds a customer to the customer slice.
func (*OpenContainer) AddEmp ¶
func (c *OpenContainer) AddEmp(emp []schema.Party)
AddEmp adds a employee to the employee slice.
func (*OpenContainer) AddExp ¶
func (c *OpenContainer) AddExp(exp schema.Expenses)
AddExp adds a expense to the expense slice.
func (*OpenContainer) AddFile ¶
func (c *OpenContainer) AddFile(file StrTuple)
AddFile adds a Tuple containing the path and the hash of it's content to the files map.
func (*OpenContainer) AddPrj ¶
func (c *OpenContainer) AddPrj(prj ProjectFiles)
AddPrj adds a project file to the project file slice.
func (*OpenContainer) Wait ¶
func (c *OpenContainer) Wait()
Wait has to be called when the data of the container should be read. The function will wait until all pending writes are done.
type ProjectFile ¶
type ProjectFile struct { Project schema.Project `yaml:"project"` Expenses schema.Expenses `yaml:"expenses"` Invoices schema.Invoices `yaml:"invoices"` }
ProjectFile is only used in distributed mode to store all invoices and expenses of a given project in the same file in the project folder. This data structure is exclusively used to store data in distributed mode and is not used internally.
func (ProjectFile) AbsolutePaths ¶
func (p ProjectFile) AbsolutePaths(prjPath string) ProjectFile
AbsolutePaths takes the location of the project folder and changes the relative paths of the assets to the correct absolute path.
type ProjectFiles ¶
type ProjectFiles []ProjectFile
ProjectFiles is a slice of ProjectFile's.
func (ProjectFiles) Expenses ¶
func (p ProjectFiles) Expenses() schema.Expenses
Expenses returns all expenses of all ProjectFile's.
func (ProjectFiles) Invoices ¶
func (p ProjectFiles) Invoices() schema.Invoices
Invoices returns all Invoices of all ProjectFile's.
func (ProjectFiles) Projects ¶
func (p ProjectFiles) Projects() schema.Projects
Projects returns all projects of all ProjectFile's.
type SaveContainer ¶
type SaveContainer struct {
// contains filtered or unexported fields
}
SaveContainer encapsulates all data which have to be written in a concurrency-safe manner.
func (*SaveContainer) AddCst ¶
func (c *SaveContainer) AddCst(cst CustomerToSave)
AddCst adds a customer to the customer slice.
func (*SaveContainer) AddPrj ¶
func (c *SaveContainer) AddPrj(prj ProjectFile)
AddProj adds a project file to the project file slice.
func (*SaveContainer) Wait ¶
func (c *SaveContainer) Wait()
Wait has to be called when the data of the container should be read. The function will wait until all pending writes are done.