Documentation ¶
Overview ¶
*
- Copyright 2021 Napptive *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- https://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Index ¶
- Constants
- type ElasticProvider
- func (e *ElasticProvider) Add(metadata *entities.ApplicationInfo) (*entities.ApplicationInfo, error)
- func (e *ElasticProvider) CreateIndex(mapping string) error
- func (e *ElasticProvider) DeleteIndex() error
- func (e *ElasticProvider) Exists(appID *entities.ApplicationID) (bool, error)
- func (e *ElasticProvider) FillCache()
- func (e *ElasticProvider) Finish()
- func (e *ElasticProvider) GenerateCatalogID(namespace, appName, tag string) string
- func (e *ElasticProvider) GenerateID(info *entities.ApplicationInfo) string
- func (e *ElasticProvider) GenerateIDFromAppID(metadata *entities.ApplicationID) string
- func (e *ElasticProvider) Get(appID *entities.ApplicationID) (*entities.ApplicationInfo, error)
- func (e *ElasticProvider) GetSummary() (*entities.Summary, error)
- func (e *ElasticProvider) IndexExists() (bool, error)
- func (e *ElasticProvider) Init() error
- func (e *ElasticProvider) List(namespace string) ([]*entities.ApplicationInfo, error)
- func (e *ElasticProvider) ListSummary(namespace string) ([]*entities.AppSummary, error)
- func (e *ElasticProvider) Remove(appID *entities.ApplicationID) error
- type MetadataProvider
Constants ¶
const ( // NamespaceField with the name of the field where we store the name of the repository NamespaceField = "Namespace" // ApplicationField with the name of the field where we store the name of the application ApplicationField = "ApplicationName" // TagField with the name of the field where we store the name of tag/version TagField = "Tag" // CatalogIDField with the name of the field where we store the internal ID CatalogIDField = "CatalogID" // CacheRefreshTime ick duration to update cache CacheRefreshTime = time.Second * 30 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ElasticProvider ¶
type ElasticProvider struct { // Mutex to protect cache access sync.Mutex // contains filtered or unexported fields }
func NewElasticProvider ¶
func NewElasticProvider(index string, address string) (*ElasticProvider, error)
NewElasticProvider returns new Elastic provider
func (*ElasticProvider) Add ¶
func (e *ElasticProvider) Add(metadata *entities.ApplicationInfo) (*entities.ApplicationInfo, error)
Add stores new application metadata or updates it if it exists
func (*ElasticProvider) CreateIndex ¶
func (e *ElasticProvider) CreateIndex(mapping string) error
CreateIndex creates an index with the mapping received
func (*ElasticProvider) DeleteIndex ¶
func (e *ElasticProvider) DeleteIndex() error
DeleteIndex removes a elastic index
func (*ElasticProvider) Exists ¶
func (e *ElasticProvider) Exists(appID *entities.ApplicationID) (bool, error)
Exists checks if the application Metadata already exists
func (*ElasticProvider) FillCache ¶
func (e *ElasticProvider) FillCache()
FillCache refresh the cache with the applications
func (*ElasticProvider) Finish ¶
func (e *ElasticProvider) Finish()
Finish method to exist in an orderly way
func (*ElasticProvider) GenerateCatalogID ¶ added in v1.0.2
func (e *ElasticProvider) GenerateCatalogID(namespace, appName, tag string) string
GenerateCatalogID generates the catalog ID (field stored in elastic) as namespace/appName:tag
func (*ElasticProvider) GenerateID ¶ added in v1.0.2
func (e *ElasticProvider) GenerateID(info *entities.ApplicationInfo) string
GenerateID generates the document _id
func (*ElasticProvider) GenerateIDFromAppID ¶ added in v1.0.2
func (e *ElasticProvider) GenerateIDFromAppID(metadata *entities.ApplicationID) string
GenerateIDFromAppID generates the document _id
func (*ElasticProvider) Get ¶
func (e *ElasticProvider) Get(appID *entities.ApplicationID) (*entities.ApplicationInfo, error)
Get returns the application metadata requested
func (*ElasticProvider) GetSummary ¶
func (e *ElasticProvider) GetSummary() (*entities.Summary, error)
GetSummary returns the catalog summary
func (*ElasticProvider) IndexExists ¶
func (e *ElasticProvider) IndexExists() (bool, error)
IndexExists check if an index exists
func (*ElasticProvider) Init ¶
func (e *ElasticProvider) Init() error
Init creates the index and the necessary index
func (*ElasticProvider) List ¶
func (e *ElasticProvider) List(namespace string) ([]*entities.ApplicationInfo, error)
List returns all the applications stored
func (*ElasticProvider) ListSummary ¶
func (e *ElasticProvider) ListSummary(namespace string) ([]*entities.AppSummary, error)
ListSummary returns all the catalog applications. if it doesn't ask for namespace -> returns cache if namespace is filled -> elastic query
func (*ElasticProvider) Remove ¶
func (e *ElasticProvider) Remove(appID *entities.ApplicationID) error
Remove deletes an application from the catalog
type MetadataProvider ¶
type MetadataProvider interface { // Add stores new application metadata or updates it if it exists Add(metadata *entities.ApplicationInfo) (*entities.ApplicationInfo, error) // Get returns the application metadata requested or an error if it does not exist Get(appID *entities.ApplicationID) (*entities.ApplicationInfo, error) // Exists checks if an application metadata exists Exists(appID *entities.ApplicationID) (bool, error) // Remove removes an application metadata Remove(appID *entities.ApplicationID) error // List returns the applications stored List(namespace string) ([]*entities.ApplicationInfo, error) // ListSummary returns a list of application summaries ListSummary(namespace string) ([]*entities.AppSummary, error) // GetSummary returns the catalog summary GetSummary() (*entities.Summary, error) }
MetadataProvider is an interface with the methods of a metadata provider must implement