mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-07 15:31:30 +02:00
remove comments
This commit is contained in:
@@ -140,10 +140,6 @@ func (m *managerImpl) DeleteNetwork(ctx context.Context, accountID, userID, netw
|
||||
return fmt.Errorf("failed to get routers in network: %w", err)
|
||||
}
|
||||
|
||||
// Carry the cascade-deleted resources and routers in the Change so the
|
||||
// post-commit Expand walks their groups too: a resource whose group is a
|
||||
// policy source affects that source's peers, which a network-only Change
|
||||
// would miss. Hydrate each resource's GroupIDs (gorm:"-") before Load.
|
||||
for _, resource := range resources {
|
||||
groups, err := transaction.GetResourceGroups(ctx, store.LockingStrengthNone, accountID, resource.ID)
|
||||
if err != nil {
|
||||
@@ -156,7 +152,6 @@ func (m *managerImpl) DeleteNetwork(ctx context.Context, accountID, userID, netw
|
||||
change.Resources = resources
|
||||
change.Routers = netRouters
|
||||
|
||||
// Load before the cascade deletes: pre-state still references the network.
|
||||
var lerr error
|
||||
if snap, lerr = affectedpeers.Load(ctx, transaction, accountID, change); lerr != nil {
|
||||
return lerr
|
||||
|
||||
@@ -269,8 +269,6 @@ func (m *managerImpl) UpdateResource(ctx context.Context, userID string, resourc
|
||||
m.accountManager.StoreEvent(ctx, userID, resource.ID, resource.AccountID, activity.NetworkResourceUpdated, resource.EventMeta(network))
|
||||
})
|
||||
|
||||
// Carry both the old and new resource so policies that targeted the resource
|
||||
// via a now-detached group still refresh their source peers.
|
||||
change = affectedpeers.Change{Resources: []*types.NetworkResource{oldResource, resource}}
|
||||
if snap, err = affectedpeers.Load(ctx, transaction, resource.AccountID, change); err != nil {
|
||||
return err
|
||||
@@ -363,8 +361,6 @@ func (m *managerImpl) DeleteResource(ctx context.Context, accountID, userID, net
|
||||
var snap *affectedpeers.Snapshot
|
||||
var change affectedpeers.Change
|
||||
err = m.store.ExecuteInTransaction(ctx, func(transaction store.Store) error {
|
||||
// Capture the resource and its groups before delete: the post-delete state
|
||||
// no longer references it.
|
||||
existing, err := transaction.GetNetworkResourceByID(ctx, store.LockingStrengthUpdate, accountID, resourceID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get network resource: %w", err)
|
||||
|
||||
@@ -207,9 +207,6 @@ func (m *managerImpl) updateRouterInTransaction(ctx context.Context, transaction
|
||||
return nil, nil, affectedpeers.Change{}, fmt.Errorf("failed to increment network serial: %w", err)
|
||||
}
|
||||
|
||||
// Carry both the previous and updated router so the bridge folds the old and
|
||||
// new routing peers; a repoint loses the old peers' routing role and the
|
||||
// post-update state can no longer reach them.
|
||||
change := affectedpeers.Change{Routers: []*types.NetworkRouter{existing, router}}
|
||||
snap, err := affectedpeers.Load(ctx, transaction, router.AccountID, change)
|
||||
if err != nil {
|
||||
@@ -232,8 +229,6 @@ func (m *managerImpl) DeleteRouter(ctx context.Context, accountID, userID, netwo
|
||||
var snap *affectedpeers.Snapshot
|
||||
var change affectedpeers.Change
|
||||
err = m.store.ExecuteInTransaction(ctx, func(transaction store.Store) error {
|
||||
// Capture the router before delete: its peers lose their routing role and
|
||||
// the post-delete state can no longer reach them.
|
||||
existing, err := transaction.GetNetworkRouterByID(ctx, store.LockingStrengthUpdate, accountID, routerID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get network router: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user