Documentation
¶
Index ¶
- func CompareMaps(m, n map[string]string) bool
- func CreateCompApp(ca CompositeApp) (string, error)
- func DeleteActiveContextRecord(acID string) (bool, error)
- func DeleteAppContextData(key string) error
- func FindApp(ca CompositeApp, app string) bool
- func FindCluster(ca CompositeApp, app string, cluster string) bool
- func FindResource(ca CompositeApp, app, cluster, res string) bool
- func GetAllActiveContext() ([]string, error)
- func GetAppContextStatus(cid interface{}, key string) (string, error)
- func HandleAppContext(a interface{}, ucid interface{}, e RsyncEvent, con Connector) error
- func LoadMap(str string) map[string]string
- func PrintCompositeApp(ca CompositeApp)
- func ReadAppContext(contextID interface{}) (CompositeApp, error)
- func RecordActiveContext(acID string) (bool, error)
- func RestartAppContext(a interface{}, con Connector) error
- func RestoreActiveContext() error
- func UpdateAppContextFlag(cid interface{}, key string, b bool) error
- type AppContextData
- type AppContextQueueUtils
- func (aq *AppContextQueueUtils) CreateQueue(qElement types.AppContextQueueElement) (bool, error)
- func (aq *AppContextQueueUtils) Enqueue(qElement types.AppContextQueueElement) (bool, error)
- func (aq *AppContextQueueUtils) FindFirstPending() (int, types.AppContextQueueElement)
- func (aq *AppContextQueueUtils) GetAppContextQueue() (types.AppContextQueue, error)
- func (aq *AppContextQueueUtils) GetAppContextQueueLength() (int, error)
- func (aq *AppContextQueueUtils) GetAppContextQueuePeek() (types.AppContextQueueElement, error)
- func (aq *AppContextQueueUtils) UpdateQueue(q []types.AppContextQueueElement) (bool, error)
- func (aq *AppContextQueueUtils) UpdateStatus(index int, status string) error
- type AppContextUtils
- func (a *AppContextUtils) AddResourceStatus(name string, app string, cluster string, status interface{}, acID string) error
- func (a *AppContextUtils) GetAppContextFlag(key string) (bool, error)
- func (a *AppContextUtils) GetAppContextStatus(key string) (appcontext.AppContextStatus, error)
- func (a *AppContextUtils) GetClusterReadyStatus(app, cluster string) appcontext.StatusValue
- func (a *AppContextUtils) GetNamespace() (string, string)
- func (a *AppContextUtils) GetRes(name string, app string, cluster string) ([]byte, interface{}, error)
- func (a *AppContextUtils) GetStatusAppContext(key string) (string, error)
- func (a *AppContextUtils) GetSubResApprove(name string, app string, cluster string) ([]byte, interface{}, error)
- func (a *AppContextUtils) PutRes(name string, app string, cluster string, data []byte) error
- func (a *AppContextUtils) SetClusterReadyStatus(app, cluster string, status appcontext.StatusValue)
- func (a *AppContextUtils) UpdateAppContextFlag(key string, b bool) error
- func (a *AppContextUtils) UpdateAppContextStatus(key string, status interface{}) error
- type CompositeAppContext
- func (instca *CompositeAppContext) InstantiateComApp(cid interface{}) error
- func (instca *CompositeAppContext) ReadComApp(cid interface{}) error
- func (instca *CompositeAppContext) TerminateComApp(cid interface{}) error
- func (instca *CompositeAppContext) UpdateComApp(cid interface{}, ucid interface{}) error
- type Context
- type Match
- type MockClient
- func (m *MockClient) Apply(content []byte) error
- func (m *MockClient) Approve(name string, sa []byte) error
- func (m *MockClient) Delete(content []byte) error
- func (m *MockClient) Get(gvkRes []byte, namespace string) ([]byte, error)
- func (m *MockClient) IsReachable() error
- func (m *MockClient) TagResource(res []byte, label string) ([]byte, error)
- type MockConnector
- func (c *MockConnector) GetClientInternal(cluster string, level string, namespace string) (ClientProvider, error)
- func (c *MockConnector) GetStatusCR(label string) ([]byte, error)
- func (c *MockConnector) Init(id interface{}) error
- func (c *MockConnector) RemoveClient()
- func (c *MockConnector) StartClusterWatcher(cluster string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareMaps ¶
func CreateCompApp ¶
CreateCompApp creates a AppContext for a composite app, for testing
func DeleteActiveContextRecord ¶
DeleteActiveContextRecord deletes an active contextID
func DeleteAppContextData ¶
Delete per AppContext thread data
func FindCluster ¶
FindCluster finds cluster in an app in the appcontext and returns true or false
func FindResource ¶
FindCluster finds resource in a cluster in an app in the appcontext and returns true or false
func GetAllActiveContext ¶
GetAllActiveContext shall return all the active contextIDs
func GetAppContextStatus ¶
func HandleAppContext ¶
func HandleAppContext(a interface{}, ucid interface{}, e RsyncEvent, con Connector) error
HandleAppContext adds event to queue and starts main thread
func PrintCompositeApp ¶
func PrintCompositeApp(ca CompositeApp)
PrintCompositeApp prints the composite app
func ReadAppContext ¶
func ReadAppContext(contextID interface{}) (CompositeApp, error)
ReadAppContext reads a composite app for AppContext
func RecordActiveContext ¶
RecordActiveContext shall insert into contextDB a key and value like /activecontext/99999999888/->99999999888. 99999999888 is sample AppcontextID It shall take in activeContextID
func RestartAppContext ¶
func RestartAppContext(a interface{}, con Connector) error
RestartAppContext called in Restart scenario to handle an AppContext
func RestoreActiveContext ¶
func RestoreActiveContext() error
RestoreActiveContext shall be called everytime the rsync restarts. It makes sure that the AppContexts which were in active state before rsync got cancelled, are restored and queued up again for processing.
func UpdateAppContextFlag ¶
Types ¶
type AppContextData ¶
AppContextData struct
type AppContextQueueUtils ¶
type AppContextQueueUtils struct {
// contains filtered or unexported fields
}
func (*AppContextQueueUtils) CreateQueue ¶
func (aq *AppContextQueueUtils) CreateQueue(qElement types.AppContextQueueElement) (bool, error)
func (*AppContextQueueUtils) Enqueue ¶
func (aq *AppContextQueueUtils) Enqueue(qElement types.AppContextQueueElement) (bool, error)
Enqueue shall append new Q-Elemenet in the string format
func (*AppContextQueueUtils) FindFirstPending ¶
func (aq *AppContextQueueUtils) FindFirstPending() (int, types.AppContextQueueElement)
func (*AppContextQueueUtils) GetAppContextQueue ¶
func (aq *AppContextQueueUtils) GetAppContextQueue() (types.AppContextQueue, error)
GetAppContextQueue shall return the AppContextQueue
func (*AppContextQueueUtils) GetAppContextQueueLength ¶
func (aq *AppContextQueueUtils) GetAppContextQueueLength() (int, error)
GetAppContextQueueLength shall return the length of the AppContextQueue
func (*AppContextQueueUtils) GetAppContextQueuePeek ¶
func (aq *AppContextQueueUtils) GetAppContextQueuePeek() (types.AppContextQueueElement, error)
GetAppContextQueuePeek shall return the String value at the peak of the AppContextQueue
func (*AppContextQueueUtils) UpdateQueue ¶
func (aq *AppContextQueueUtils) UpdateQueue(q []types.AppContextQueueElement) (bool, error)
func (*AppContextQueueUtils) UpdateStatus ¶
func (aq *AppContextQueueUtils) UpdateStatus(index int, status string) error
type AppContextUtils ¶
type AppContextUtils struct {
// contains filtered or unexported fields
}
func (*AppContextUtils) AddResourceStatus ¶
func (a *AppContextUtils) AddResourceStatus(name string, app string, cluster string, status interface{}, acID string) error
Add resource level for a status Function adds any missing levels to AppContext
func (*AppContextUtils) GetAppContextFlag ¶
func (a *AppContextUtils) GetAppContextFlag(key string) (bool, error)
GetAppContextFlag gets the stop flag
func (*AppContextUtils) GetAppContextStatus ¶
func (a *AppContextUtils) GetAppContextStatus(key string) (appcontext.AppContextStatus, error)
GetAppContextStatus gets the status
func (*AppContextUtils) GetClusterReadyStatus ¶
func (a *AppContextUtils) GetClusterReadyStatus(app, cluster string) appcontext.StatusValue
GetClusterReadyStatus sets the cluster ready status does not return an error, just a status of Unknown if the cluster readystatus key does not exist or any other error occurs.
func (*AppContextUtils) GetNamespace ¶
func (a *AppContextUtils) GetNamespace() (string, string)
GetNamespace reads namespace from metadata
func (*AppContextUtils) GetRes ¶
func (a *AppContextUtils) GetRes(name string, app string, cluster string) ([]byte, interface{}, error)
GetRes Reads resource
func (*AppContextUtils) GetStatusAppContext ¶
func (a *AppContextUtils) GetStatusAppContext(key string) (string, error)
GetAppContextFlag gets the statusappctxid
func (*AppContextUtils) GetSubResApprove ¶
func (a *AppContextUtils) GetSubResApprove(name string, app string, cluster string) ([]byte, interface{}, error)
GetSubResApprove Reads sub resource
func (*AppContextUtils) SetClusterReadyStatus ¶
func (a *AppContextUtils) SetClusterReadyStatus(app, cluster string, status appcontext.StatusValue)
SetClusterReadyStatus gets the cluster ready status
func (*AppContextUtils) UpdateAppContextFlag ¶
func (a *AppContextUtils) UpdateAppContextFlag(key string, b bool) error
UpdateAppContextFlag to update flags
func (*AppContextUtils) UpdateAppContextStatus ¶
func (a *AppContextUtils) UpdateAppContextStatus(key string, status interface{}) error
UpdateAppContextStatus updates a field in AppContext
type CompositeAppContext ¶
type CompositeAppContext struct {
// contains filtered or unexported fields
}
CompositeAppContext represents composite app
func (*CompositeAppContext) InstantiateComApp ¶
func (instca *CompositeAppContext) InstantiateComApp(cid interface{}) error
InstantiateComApp Instantiatep Aps in Composite App
func (*CompositeAppContext) ReadComApp ¶
func (instca *CompositeAppContext) ReadComApp(cid interface{}) error
ReadComApp Reads resources in AppContext
func (*CompositeAppContext) TerminateComApp ¶
func (instca *CompositeAppContext) TerminateComApp(cid interface{}) error
TerminateComApp Terminates Apps in Composite App
func (*CompositeAppContext) UpdateComApp ¶
func (instca *CompositeAppContext) UpdateComApp(cid interface{}, ucid interface{}) error
UpdateComApp Updates Apps in Composite App
type Context ¶
type Context struct { Lock *sync.Mutex Running bool Channel chan RsyncEvent // contains filtered or unexported fields }
Context is Per AppContext struct
func CreateAppContextData ¶
Create per AppContext thread data
func (*Context) EnqueueToAppContext ¶
EnqueueToAppContext adds the event to the appContext Queue
type Match ¶
type Match struct { // Collects all resources that are deleted DeleteMatchList sync.Map // Collects all resources that are applied ApplyMatchList sync.Map // Collects all resources that are currently applied on the cluster ResourceList sync.Map }
Match stores information about resources applied in clusters
var MatchList Match
MatchList to collect resources
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient mocks client
func (*MockClient) Apply ¶
func (m *MockClient) Apply(content []byte) error
Apply Collects resources applied to cluster
func (*MockClient) Delete ¶
func (m *MockClient) Delete(content []byte) error
Delete Collects resources deleted from cluster
func (*MockClient) IsReachable ¶
func (m *MockClient) IsReachable() error
func (*MockClient) TagResource ¶
func (m *MockClient) TagResource(res []byte, label string) ([]byte, error)
type MockConnector ¶
type MockConnector struct { sync.Mutex Clients *sync.Map // contains filtered or unexported fields }
MockConnector mocks connector interface
func (*MockConnector) GetClientInternal ¶
func (c *MockConnector) GetClientInternal(cluster string, level string, namespace string) (ClientProvider, error)
func (*MockConnector) GetStatusCR ¶
func (c *MockConnector) GetStatusCR(label string) ([]byte, error)
func (*MockConnector) Init ¶
func (c *MockConnector) Init(id interface{}) error
func (*MockConnector) RemoveClient ¶
func (c *MockConnector) RemoveClient()
func (*MockConnector) StartClusterWatcher ¶
func (c *MockConnector) StartClusterWatcher(cluster string) error