2022-11-01 19:03:23 +00:00
|
|
|
package service
|
|
|
|
|
2023-02-14 22:22:09 +00:00
|
|
|
import (
|
|
|
|
"context"
|
2023-02-24 20:57:44 +00:00
|
|
|
|
2023-02-14 22:22:09 +00:00
|
|
|
"github.com/hashicorp/consul/api"
|
|
|
|
)
|
2023-01-04 20:28:15 +00:00
|
|
|
|
2022-11-01 19:03:23 +00:00
|
|
|
// Service represents a process that will be registered with the
|
|
|
|
// Consul catalog, including Consul components such as sidecars and gateways
|
|
|
|
type Service interface {
|
2023-02-14 22:22:09 +00:00
|
|
|
Exec(ctx context.Context, cmd []string) (string, error)
|
2023-01-04 20:28:15 +00:00
|
|
|
// Export a service to the peering cluster
|
|
|
|
Export(partition, peer string, client *api.Client) error
|
2023-01-20 22:02:44 +00:00
|
|
|
GetAddr() (string, int)
|
2023-02-22 15:22:25 +00:00
|
|
|
GetAddrs() (string, []int)
|
2023-02-24 20:57:44 +00:00
|
|
|
GetPort(port int) (int, error)
|
2023-02-14 22:22:09 +00:00
|
|
|
// GetAdminAddr returns the external admin address
|
2023-01-18 21:13:55 +00:00
|
|
|
GetAdminAddr() (string, int)
|
2023-01-20 22:02:44 +00:00
|
|
|
GetLogs() (string, error)
|
|
|
|
GetName() string
|
|
|
|
GetServiceName() string
|
|
|
|
Start() (err error)
|
2023-02-15 15:26:43 +00:00
|
|
|
Stop() (err error)
|
2023-01-20 22:02:44 +00:00
|
|
|
Terminate() error
|
2023-01-27 16:25:48 +00:00
|
|
|
Restart() error
|
2023-02-01 15:48:54 +00:00
|
|
|
GetStatus() (string, error)
|
2022-11-01 19:03:23 +00:00
|
|
|
}
|