diff options
| author | chrislu <chris.lu@gmail.com> | 2025-10-30 20:56:13 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-10-30 20:56:13 -0700 |
| commit | bba8931d64e412a296a20f153b9a62f7b7d4f4dc (patch) | |
| tree | 3eac3f82a97fb4f0f86e46005deed4940e0463f5 /postgres-examples/test_client.py | |
| parent | c238153a3b2aa8811748b241e55a72b47ced71c7 (diff) | |
| download | seaweedfs-bba8931d64e412a296a20f153b9a62f7b7d4f4dc.tar.xz seaweedfs-bba8931d64e412a296a20f153b9a62f7b7d4f4dc.zip | |
Improve encapsulation: Add shallowClone() method to vidMap
Added a shallowClone() method to vidMap to improve encapsulation and prevent
MasterClient from directly accessing vidMap's internal fields.
Changes:
1. Added vidMap.shallowClone() in vid_map.go
- Encapsulates the shallow copy logic within vidMap
- Makes vidMap responsible for its own state representation
- Documented that caller is responsible for thread safety
2. Simplified resetVidMap() in masterclient.go
- Uses tail := mc.vidMap.shallowClone() instead of manual field access
- Cleaner, more maintainable code
- Better adherence to encapsulation principles
Benefits:
- Improved code organization and maintainability
- vidMap internals are now properly encapsulated
- Easier to modify vidMap structure in the future
- More self-documenting code
Verified with: go test -race ./weed/wdclient/... (passes)
Diffstat (limited to 'postgres-examples/test_client.py')
0 files changed, 0 insertions, 0 deletions
