You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package carvelgen
typeAnyBundleinterface {}
// Bundle is the entity namevar_AnyBundle=BundleSpecs{}
// NestedBundle is fit to be considered as the entity name// Note: It is important to avoid considering `Nested` as a behaviour// Note: `Nest` can be considered as behaviour// Note: `Nested` can be considered as the state of the entity var_AnyBundle=NestedBundleSpecs{}
// Bundle creates a new bundle// Nice: No need for NestedBundle APIfuncBundle(specsAnyBundle) (BundleResult, error)
Attempt 3
// Package carvel deals all things about carvel // Note: Removed `gen` suffix. // Note: It is not good practice to tie behaviour & entity together to name a package// Note: Package `carvelgen` can not expose List, Get, Delete etc. APIspackage carvel
// NewBundle creates a new package bundle instance// Idiomatic: NewXXX implies creating a memory object// Avoid: NewPackageBundle etc. since carvel folks can understand without the extra bitsfuncNewBundle()
// CreateBundle creates a new bundle in the PWD with .tar.gz as the file extension// Note: CreateBundle differentiates clearly from NewBundlefuncCreateBundle()
// GetBundle fetches the bundle as a file from Gobuild, Artifactory, etc.// Note: The specifics of fetching from Gobuild or Artifactory is handled via Specs// E.g.: GobuildBundleGetSpecs, ArtifactoryBundleGetSpecs//// Even better with GobuildBundleSpecs, ArtifactoryBundleSpecs, etc.// Since it is best to avoid attaching behaviour with entity to name another entityfuncGetBundle()
// DeleteBundle deletes the bundle from Gobuild, Artifactory, etc.// Note: The specifics of deleting the exact bundle from Gobuild or Artifactory// is handled via Specs// E.g.: GobuildBundleSpecs, ArtifactoryBundleSpecsfuncDeleteBundle()
// ListBundle lists the bundles from artifactory, gobuild, etc.// Note: The specifics of listing from Gobuild, Artifactory, etc is handled via Specs// E.g.: GobuildBundleSpecs, ArtifactoryBundleSpecsfuncListBundle()
Attempt 4
file: relm/pkg/carvel/bundle.go
package carvel
// Note: Single method contract per APItypeAnyBundleNewinterface {
newBundle()
}
typeAnyBundleCreateinterface {
createBundle()
}
typeAnyBundleGetinterface {
getBundle()
}
// Notes:// - Single specs for all contracts wherever possible// - One or more specs for all contracts if required// - `Action` field will help switch to the exact contract method// - `State` [optional] field further allows to switch logic per actionvar_AnyBundleNew=BundleSpecs {} // Action: Newvar_AnyBundleCreate=BundleSpecs {} // Action: Createvar_AnyBundleCreate=PackageCRBundleSpecs {} // Action: Createvar_AnyBundleCreate=GobuildBundleSpecs {} // Action: Createvar_AnyBundleCreate=ArtifactoryBundleSpecs {} // Action: Createvar_AnyBundleCreate=BuildsquidBundleSpecs {} // Action: Createvar_AnyBundleGet=GobuildBundleSpecs {} // Action: Getvar_AnyBundleGet=ArtifactoryBundleSpecs {} // Action: Getvar_AnyBundleList=GobuildBundleSpecs {} // Action: Listvar_AnyBundleList=ArtifactoryBundleSpecs {} // Action: Listvar_AnyBundlePush=ArtifactoryBundleSpecs {} // Action: Pushvar_AnyBundlePush=DevArtifactoryBundleSpecs {} // Action: Pushvar_AnyBundlePush=CDNBundleSpecs {} // Action: Push/* These signatures say it all */funcCreateBundle(specsAnyBundleCreate) (BundleResult, error)
funcGetBundle(specsAnyBundleGet) (BundleResult, error)
funcListBundle(specsAnyBundleList, more...AnyBundleList) (BundleResult, error)
funcDeleteBundle(specsAnyBundleDelete) (BundleResult, error)
funcPushBundle(specsAnyBundlePush) (BundleResult, error)
funcNewBundle(specsAnyBundleNew) (Bundle, error) // * Bundle, not BundleResult
The text was updated successfully, but these errors were encountered:
AmitKumarDas
changed the title
api names: experience: design with future in mind
api names: experiment with the design with flexibility in mind
Jul 12, 2024
15/JUL/2024
Attempt 1
Attempt 2
Attempt 3
Attempt 4
relm/pkg/carvel/bundle.go
The text was updated successfully, but these errors were encountered: