schema: Add resource name validation method #27

Merged
fyrchik merged 1 commits from aarifullin/policy-engine:feature/26-resource_validation into master 2023-12-19 16:41:03 +00:00
Collaborator

Close #26

Signed-off-by: Airat Arifullin aarifullin@yadro.com

Close [#26](https://git.frostfs.info/TrueCloudLab/policy-engine/issues/26) Signed-off-by: Airat Arifullin <aarifullin@yadro.com>
aarifullin added the
enhancement
label 2023-12-07 15:51:44 +00:00
aarifullin requested review from storage-core-committers 2023-12-07 15:51:54 +00:00
aarifullin requested review from storage-core-developers 2023-12-07 15:51:54 +00:00
aarifullin force-pushed feature/26-resource_validation from edf9efcd03 to 07a8a3b0f3 2023-12-07 15:52:21 +00:00 Compare
aarifullin force-pushed feature/26-resource_validation from 07a8a3b0f3 to 20f23004af 2023-12-07 15:57:53 +00:00 Compare
fyrchik reviewed 2023-12-08 07:10:26 +00:00
@ -0,0 +35,4 @@
return true
}
func IsNativeResourceNameValid(resource string) bool {

Validation method is nice, but can we also describe this somewhere in docs?
Also, what about a benchmark? There are some opportunities for an optimization.

Validation method is nice, but can we also describe this somewhere in docs? Also, what about a benchmark? There are some opportunities for an optimization.
Poster
Collaborator

I've added docs where I also describe what is a resource from the APE point. Waiting for your comments and notes :)

I've added `docs` where I also describe what is a resource from the APE point. Waiting for your comments and notes :)
Poster
Collaborator

I've also added a benchmark test

I've also added a benchmark test
dstepanov-yadro approved these changes 2023-12-08 07:15:49 +00:00
aarifullin force-pushed feature/26-resource_validation from 20f23004af to 0c104e90e4 2023-12-13 19:18:11 +00:00 Compare
aarifullin reviewed 2023-12-13 19:20:50 +00:00
docs/resource.md Outdated
@ -0,0 +4,4 @@
This can be an object in a container within a namespace, or all objects in a container,
or all containers within the root namespace etc.
A resource can be viewed from two sides:
Poster
Collaborator

The idea is not fully unfolded, but I suggest to give more details when we will describe the chain router

The idea is not fully unfolded, but I suggest to give more details when we will describe the chain router
acid-ant approved these changes 2023-12-14 07:38:39 +00:00
aarifullin requested review from dstepanov-yadro 2023-12-14 07:41:31 +00:00
aarifullin requested review from storage-services-committers 2023-12-14 08:55:19 +00:00
aarifullin requested review from storage-services-developers 2023-12-14 08:55:19 +00:00
dkirillov approved these changes 2023-12-14 12:46:26 +00:00
dstepanov-yadro approved these changes 2023-12-14 13:31:53 +00:00
fyrchik reviewed 2023-12-18 07:16:41 +00:00
@ -0,0 +89,4 @@
func BenchmarkIsNativeResourceNameValid(b *testing.B) {
for _, test := range tests {
b.Run(test.name, func(b *testing.B) {
for i := 0; i < 2000; i++ {

Why 2000, not b.N?

Why `2000`, not `b.N`?
Poster
Collaborator

Fixed!

Fixed!
aarifullin force-pushed feature/26-resource_validation from 0c104e90e4 to e4e381b8a4 2023-12-18 07:58:36 +00:00 Compare
aarifullin requested review from acid-ant 2023-12-18 07:59:59 +00:00
aarifullin requested review from dkirillov 2023-12-18 08:00:00 +00:00
aarifullin requested review from dstepanov-yadro 2023-12-18 08:00:02 +00:00
dstepanov-yadro approved these changes 2023-12-18 14:19:20 +00:00
acid-ant approved these changes 2023-12-19 06:40:43 +00:00
fyrchik merged commit e57d213595 into master 2023-12-19 16:41:03 +00:00
Sign in to join this conversation.
There is no content yet.