ape: Initialize and use policy contract interface #871

Merged
fyrchik merged 1 commit from aarifullin/frostfs-node:feature/851-use_policy_contract into master 2023-12-18 11:06:37 +00:00
Member

Replace inmemory policy contract implementation by initialized policy contract interface.

Close #851

Replace inmemory policy contract implementation by initialized policy contract interface. Close #851
aarifullin requested review from storage-core-committers 2023-12-14 12:18:29 +00:00
aarifullin reviewed 2023-12-14 12:18:58 +00:00
go.mod Outdated
@ -2,6 +2,8 @@ module git.frostfs.info/TrueCloudLab/frostfs-node
go 1.20
replace git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20231211080303-8c673ee4f4af => git.frostfs.info/aarifullin/policy-engine v0.0.0-20231212185618-def903261503
Author
Member

Waits for ape #32

Waits for [ape #32](https://git.frostfs.info/TrueCloudLab/policy-engine/pulls/32)
aarifullin marked this conversation as resolved
aarifullin requested review from storage-core-developers 2023-12-14 12:21:06 +00:00
aarifullin force-pushed feature/851-use_policy_contract from e10d2bdaba to f7ee4846d3 2023-12-14 13:06:20 +00:00 Compare
dstepanov-yadro approved these changes 2023-12-14 13:33:12 +00:00
aarifullin requested review from storage-core-committers 2023-12-15 11:36:05 +00:00
dstepanov-yadro approved these changes 2023-12-15 11:45:51 +00:00
acid-ant approved these changes 2023-12-15 12:05:44 +00:00
fyrchik reviewed 2023-12-18 07:15:59 +00:00
@ -98,14 +98,15 @@ func initApp(ctx context.Context, c *cfg) {
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Init(ctx))
})
initAndLog(c, "gRPC", initGRPC)
Owner

Why this change?

Why this change?
Author
Member

initNetmapService -> initMorphComponents -> c.cfgMorph.client = cli

And then use it for initAccessPolicyEngine(ctx, c) ->

morphRuleStorage := policy_client.NewContractStorage(
		c.cfgMorph.client.GetActor(),
		c.cfgObject.cfgAccessPolicyEngine.policyContractHash)
`initNetmapService` -> `initMorphComponents` -> `c.cfgMorph.client = cli` And then use it for `initAccessPolicyEngine(ctx, c)` -> ```go morphRuleStorage := policy_client.NewContractStorage( c.cfgMorph.client.GetActor(), c.cfgObject.cfgAccessPolicyEngine.policyContractHash) ```
Owner

Oh, it is ape initialization below, storage engine is still before services, ok.

Oh, it is ape initialization below, storage engine is still before services, ok.
fyrchik marked this conversation as resolved
@ -541,1 +541,4 @@
}
func (c *Client) GetActor() *actor.Actor {
return c.rpcActor
Owner

How thread-safe is it?

How thread-safe is it?
Author
Member

I have add rwMutext locking before getting c.rpcActor.

You're right: this is not sensitive during initialization but can lead to UB if GetActor() is used in other cases

I have add rwMutext locking before getting `c.rpcActor`. You're right: this is not sensitive during initialization but can lead to UB if `GetActor()` is used in other cases
fyrchik marked this conversation as resolved
aarifullin force-pushed feature/851-use_policy_contract from f7ee4846d3 to 6e6eb92d17 2023-12-18 08:40:27 +00:00 Compare
aarifullin requested review from dstepanov-yadro 2023-12-18 09:09:00 +00:00
aarifullin requested review from acid-ant 2023-12-18 09:09:01 +00:00
fyrchik approved these changes 2023-12-18 11:05:25 +00:00
fyrchik merged commit 7d7cf05575 into master 2023-12-18 11:06:37 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#871
No description provided.