From e0eb330d42a197917c5642a9b849de07db478cad Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Tue, 14 Apr 2020 11:07:06 +0200 Subject: [PATCH] Add source interface spec --- docs/spec/v1alpha1/common.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/spec/v1alpha1/common.md b/docs/spec/v1alpha1/common.md index 70f50011..560e8250 100644 --- a/docs/spec/v1alpha1/common.md +++ b/docs/spec/v1alpha1/common.md @@ -4,6 +4,21 @@ Common defines resources used across all source types. ## Specification +### Source interface + +Source objects should adhere to the `Source` interface. This interface exposes the [interval](#source-synchronization) +and [artifact](#source-status) of the source to clients without the prerequisite of knowing the source kind: + +````go +type Source interface { + // GetInterval returns the interval at which the source is updated. + GetInterval() metav1.Duration + + // GetArtifact returns the latest artifact from the source, or nil. + GetArtifact() *Artifact +} +```` + ### Source synchronization Source objects should contain a `spec.interval` field that tells the controller at which interval to check for updates: