-
Notifications
You must be signed in to change notification settings - Fork 223
refactor: rename models/meshmodel to models/registry, add compat shim… #1066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ayush-kr-giga
wants to merge
2
commits into
meshery:master
Choose a base branch
from
Ayush-kr-giga:fix/ayush/meshkit-registry-rename
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,11 @@ | ||
| package entity | ||
|
|
||
| import ( | ||
| "fmt" | ||
| import registryentity "github.com/meshery/meshkit/models/registry/entity" | ||
|
|
||
| "github.com/meshery/meshkit/errors" | ||
| ) | ||
|
|
||
| const ( | ||
| ErrUpdateEntityStatusCode = "meshkit-11243" | ||
| ) | ||
| const ErrUpdateEntityStatusCode = registryentity.ErrUpdateEntityStatusCode | ||
|
|
||
| // ErrUpdateEntityStatus is a deprecated wrapper for registryentity.ErrUpdateEntityStatus. | ||
| // Deprecated: use registryentity.ErrUpdateEntityStatus instead. | ||
| func ErrUpdateEntityStatus(err error, entity string, status EntityStatus) error { | ||
| return errors.New(ErrUpdateEntityStatusCode, errors.Alert, []string{fmt.Sprintf("unable to update %s to %s", entity, status)}, []string{err.Error()}, []string{}, []string{}) | ||
| return registryentity.ErrUpdateEntityStatus(err, entity, status) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,17 @@ | ||
| package entity | ||
|
|
||
| import "github.com/meshery/meshkit/database" | ||
| import registryentity "github.com/meshery/meshkit/models/registry/entity" | ||
|
|
||
| type EntityStatus string | ||
| // EntityStatus is a deprecated alias for registryentity.EntityStatus. | ||
| // Deprecated: use registryentity.EntityStatus instead. | ||
| type EntityStatus = registryentity.EntityStatus | ||
|
|
||
| const ( | ||
| Ignored EntityStatus = "ignored" | ||
| Enabled EntityStatus = "enabled" | ||
| Duplicate EntityStatus = "duplicate" | ||
| Ignored = registryentity.Ignored | ||
| Enabled = registryentity.Enabled | ||
| Duplicate = registryentity.Duplicate | ||
| ) | ||
|
|
||
| type Status interface { | ||
| UpdateStatus(db *database.Handler, status EntityStatus) error | ||
| } | ||
| // Status is a deprecated alias for registryentity.Status. | ||
| // Deprecated: use registryentity.Status instead. | ||
| type Status = registryentity.Status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,39 @@ | ||
| // Package entity is a deprecated compatibility shim for the registry entity | ||
| // package. | ||
| // | ||
| // It exists solely because github.com/meshery/schemas@v1.3.26 (our currently | ||
| // pinned dependency) has helper files that import this path directly by | ||
| // convention. All types here are pure aliases (type X = Y) of their | ||
| // counterparts in github.com/meshery/meshkit/models/registry/entity, so | ||
| // nothing drifts between the two paths. | ||
| // | ||
| // Deprecated: import github.com/meshery/meshkit/models/registry/entity | ||
| // directly. This shim should be deleted once meshkit's go.mod pin on | ||
| // github.com/meshery/schemas is bumped past v1.3.26 to a version that no | ||
| // longer references the old meshmodel path. | ||
| package entity | ||
|
|
||
| import ( | ||
| "github.com/meshery/meshkit/database" | ||
| core "github.com/meshery/schemas/models/core" | ||
| registryentity "github.com/meshery/meshkit/models/registry/entity" | ||
| ) | ||
|
|
||
| type EntityType string | ||
| // EntityType is a deprecated alias for registryentity.EntityType. | ||
| // Deprecated: use registryentity.EntityType instead. | ||
| type EntityType = registryentity.EntityType | ||
|
|
||
| const ( | ||
| ComponentDefinition EntityType = "component" | ||
| PolicyDefinition EntityType = "policy" | ||
| RelationshipDefinition EntityType = "relationship" | ||
| Model EntityType = "model" | ||
| Category EntityType = "category" | ||
| // ConnectionDefinition is the registry entity type for connection | ||
| // definitions: uninitialized, per-model connection templates registered | ||
| // alongside components and relationships. The schemas connection helper | ||
| // (github.com/meshery/schemas/models/v1beta3/connection) reports this type. | ||
| ConnectionDefinition EntityType = "connection" | ||
| ComponentDefinition = registryentity.ComponentDefinition | ||
| PolicyDefinition = registryentity.PolicyDefinition | ||
| RelationshipDefinition = registryentity.RelationshipDefinition | ||
| Model = registryentity.Model | ||
| Category = registryentity.Category | ||
| ConnectionDefinition = registryentity.ConnectionDefinition | ||
| ) | ||
|
|
||
| // Each entity will have it's own Filter implementation via which it exposes the nobs and dials to fetch entities | ||
| type Filter interface { | ||
| Create(map[string]interface{}) | ||
| Get(db *database.Handler) (entities []Entity, count int64, unique int, err error) | ||
| GetById(db *database.Handler) (entity Entity, err error) | ||
| } | ||
| // Filter is a deprecated alias for registryentity.Filter. | ||
| // Deprecated: use registryentity.Filter instead. | ||
| type Filter = registryentity.Filter | ||
|
|
||
| type Entity interface { | ||
| // Entity is referred as any type of schema managed by the registry | ||
| // ComponentDefinitions and PolicyDefinitions are examples of entities | ||
| Type() EntityType | ||
| GetEntityDetail() string | ||
| GenerateID() (core.Uuid, error) | ||
| GetID() core.Uuid | ||
| Create(db *database.Handler, hostID core.Uuid) (entityID core.Uuid, err error) | ||
| } | ||
| // Entity is a deprecated alias for registryentity.Entity. | ||
| // Deprecated: use registryentity.Entity instead. | ||
| type Entity = registryentity.Entity | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package entity | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/meshery/meshkit/errors" | ||
| ) | ||
|
|
||
| const ( | ||
| ErrUpdateEntityStatusCode = "meshkit-11243" | ||
| ) | ||
|
|
||
| func ErrUpdateEntityStatus(err error, entity string, status EntityStatus) error { | ||
| return errors.New(ErrUpdateEntityStatusCode, errors.Alert, []string{fmt.Sprintf("unable to update %s to %s", entity, status)}, []string{err.Error()}, []string{}, []string{}) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package entity | ||
|
|
||
| import "github.com/meshery/meshkit/database" | ||
|
|
||
| type EntityStatus string | ||
|
|
||
| const ( | ||
| Ignored EntityStatus = "ignored" | ||
| Enabled EntityStatus = "enabled" | ||
| Duplicate EntityStatus = "duplicate" | ||
| ) | ||
|
|
||
| type Status interface { | ||
| UpdateStatus(db *database.Handler, status EntityStatus) error | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package entity | ||
|
|
||
| import ( | ||
| "github.com/meshery/meshkit/database" | ||
| core "github.com/meshery/schemas/models/core" | ||
| ) | ||
|
|
||
| type EntityType string | ||
|
|
||
| const ( | ||
| ComponentDefinition EntityType = "component" | ||
| PolicyDefinition EntityType = "policy" | ||
| RelationshipDefinition EntityType = "relationship" | ||
| Model EntityType = "model" | ||
| Category EntityType = "category" | ||
| // ConnectionDefinition is the registry entity type for connection | ||
| // definitions: uninitialized, per-model connection templates registered | ||
| // alongside components and relationships. The schemas connection helper | ||
| // (github.com/meshery/schemas/models/v1beta3/connection) reports this type. | ||
| ConnectionDefinition EntityType = "connection" | ||
| ) | ||
|
|
||
| // Each entity will have it's own Filter implementation via which it exposes the nobs and dials to fetch entities | ||
| type Filter interface { | ||
| Create(map[string]interface{}) | ||
| Get(db *database.Handler) (entities []Entity, count int64, unique int, err error) | ||
| GetById(db *database.Handler) (entity Entity, err error) | ||
| } | ||
|
|
||
| type Entity interface { | ||
| // Entity is referred as any type of schema managed by the registry | ||
| // ComponentDefinitions and PolicyDefinitions are examples of entities | ||
| Type() EntityType | ||
| GetEntityDetail() string | ||
| GenerateID() (core.Uuid, error) | ||
| GetID() core.Uuid | ||
| Create(db *database.Handler, hostID core.Uuid) (entityID core.Uuid, err error) | ||
| } |
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.