Documentation ¶
Overview ¶
Package repomodel provides simplified model of repository operaton.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentSet ¶
type ContentSet struct {
// contains filtered or unexported fields
}
ContentSet represents a set of contents.
func (*ContentSet) Add ¶
func (s *ContentSet) Add(d ...content.ID)
Add adds the provided items to the set.
func (*ContentSet) Clear ¶
func (s *ContentSet) Clear() ContentSet
Clear removes all elements from the set.
func (*ContentSet) PickRandom ¶
func (s *ContentSet) PickRandom() content.ID
PickRandom picks one random content from the set or empty string.
func (*ContentSet) RemoveAll ¶
func (s *ContentSet) RemoveAll(d ...content.ID)
RemoveAll removes the provided items from the set.
func (*ContentSet) Replace ¶
func (s *ContentSet) Replace(ids []content.ID)
Replace replaces all elements in the set.
func (*ContentSet) Snapshot ¶
func (s *ContentSet) Snapshot() ContentSet
Snapshot returns the snapshot of all IDs.
type ManifestSet ¶
type ManifestSet struct {
// contains filtered or unexported fields
}
ManifestSet represents a set of manifests.
func (*ManifestSet) Add ¶
func (s *ManifestSet) Add(d ...manifest.ID)
Add adds the provided items to the set.
func (*ManifestSet) Clear ¶
func (s *ManifestSet) Clear() ManifestSet
Clear removes all elements from the set.
func (*ManifestSet) PickRandom ¶
func (s *ManifestSet) PickRandom() manifest.ID
PickRandom picks one random manifest from the set or empty string.
func (*ManifestSet) RemoveAll ¶
func (s *ManifestSet) RemoveAll(d ...manifest.ID)
RemoveAll removes the provided items from the set.
func (*ManifestSet) Replace ¶
func (s *ManifestSet) Replace(ids []manifest.ID)
Replace replaces all elements in the set.
func (*ManifestSet) Snapshot ¶
func (s *ManifestSet) Snapshot() ManifestSet
Snapshot returns the snapshot of all IDs.
type OpenRepository ¶
type OpenRepository struct { RepoData *RepositoryData Contents ContentSet Manifests ManifestSet EnableMaintenance bool // contains filtered or unexported fields }
OpenRepository models the behavior of an open repository.
func (*OpenRepository) NewSession ¶
func (o *OpenRepository) NewSession() *RepositorySession
NewSession creates new model for a session to access a repository.
func (*OpenRepository) Refresh ¶
func (o *OpenRepository) Refresh()
Refresh refreshes the set of committed Contents and manifest from repositor.
type RepositoryData ¶
type RepositoryData struct { Contents ContentSet Manifests ManifestSet // contains filtered or unexported fields }
RepositoryData models the d stored in the repository.
func NewRepositoryData ¶
func NewRepositoryData() *RepositoryData
NewRepositoryData creates new RepositoryData model.
func (*RepositoryData) OpenRepository ¶
func (d *RepositoryData) OpenRepository() *OpenRepository
OpenRepository returns an OpenRepository model based on current snapshot of RepositoryData.
type RepositorySession ¶
type RepositorySession struct { OpenRepo *OpenRepository WrittenContents ContentSet WrittenManifests ManifestSet }
RepositorySession models the behavior of a single session in an repository.
func (*RepositorySession) Flush ¶
func (s *RepositorySession) Flush(wc *ContentSet, wm *ManifestSet)
Flush flushes the changes written in this RepositorySession and makes them available to other RepositoryData model.
func (*RepositorySession) Refresh ¶
func (s *RepositorySession) Refresh()
Refresh refreshes the set of committed contents and manifest from repositor.
func (*RepositorySession) WriteContent ¶
func (s *RepositorySession) WriteContent(cid content.ID)
WriteContent adds the provided content ID to the model.
func (*RepositorySession) WriteManifest ¶
func (s *RepositorySession) WriteManifest(mid manifest.ID)
WriteManifest adds the provided manifest ID to the model.