fix Policy Rules

This commit is contained in:
anlicheng 2026-05-21 12:15:46 +08:00
parent a772b67205
commit 9a56eea6cf
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
// //
// IdentityStore.swift // PolicyRuleStore.swift
// punchnet // punchnet
// 1. // 1.
// Created by on 2026/2/5. // Created by on 2026/2/5.
@ -7,7 +7,7 @@
import Foundation import Foundation
import NIO import NIO
actor IdentityStore { actor PolicyRuleStore {
// //
nonisolated private let cooldown: Duration = .seconds(5) nonisolated private let cooldown: Duration = .seconds(5)

View File

@ -9,7 +9,7 @@ import Foundation
actor PolicyService { actor PolicyService {
// //
private let identifyStore: IdentityStore private let policyRuleStore: PolicyRuleStore
nonisolated private let snapshotPublisher: SnapshotPublisher<IdentitySnapshot> nonisolated private let snapshotPublisher: SnapshotPublisher<IdentitySnapshot>
// Flow : 180 // Flow : 180
@ -22,7 +22,7 @@ actor PolicyService {
self.identityId = identityId self.identityId = identityId
// //
let snapshotPublisher = SnapshotPublisher(initial: IdentitySnapshot.empty()) let snapshotPublisher = SnapshotPublisher(initial: IdentitySnapshot.empty())
self.identifyStore = IdentityStore(publisher: snapshotPublisher) self.policyRuleStore = PolicyRuleStore(publisher: snapshotPublisher)
self.snapshotPublisher = snapshotPublisher self.snapshotPublisher = snapshotPublisher
} }
@ -40,11 +40,11 @@ actor PolicyService {
} }
func makePolicyRequest(srcIdentityID: UInt32) async -> Data? { func makePolicyRequest(srcIdentityID: UInt32) async -> Data? {
return await self.identifyStore.makePolicyRequest(srcIdentityId: srcIdentityID, dstIdentityId: self.identityId) return await self.policyRuleStore.makePolicyRequest(srcIdentityId: srcIdentityID, dstIdentityId: self.identityId)
} }
func updatePolicy(superServiceProxy: SDLSuperServiceProxy) async { func updatePolicy(superServiceProxy: SDLSuperServiceProxy) async {
let requests = await self.identifyStore.makeBatchPolicyRequests(dstIdentityID: self.identityId) let requests = await self.policyRuleStore.makeBatchPolicyRequests(dstIdentityID: self.identityId)
for request in requests { for request in requests {
await superServiceProxy.send(type: .policyRequest, data: request) await superServiceProxy.send(type: .policyRequest, data: request)
} }
@ -56,12 +56,12 @@ actor PolicyService {
return return
} }
await self.identifyStore.applyPolicyResponse(policyResponse) await self.policyRuleStore.applyPolicyResponse(policyResponse)
} }
func clear() async { func clear() async {
self.flowSessionManager.clear() self.flowSessionManager.clear()
await self.identifyStore.clear() await self.policyRuleStore.clear()
} }
deinit { deinit {