⚠️ UNOFFICIAL FORK - EDUCATIONAL/RESEARCH PURPOSES ONLYThis demonstrates a minimal diff pattern for adding async bulk operations to synchronous Python libraries. NOT an official release. NOT supported by original library maintainers.
Demonstrate clean architectural patterns for:
- Adding async/await to legacy synchronous libraries
- Maintaining 100% backward compatibility
- Enabling bulk/parallel operations via asyncio
- Minimal code changes suitable for upstream consideration
2.9.7- Original baseline (upstream v2.9.7)minimal-async-dns-bulk- Async implementation with idempotency
git diff 2.9.7 minimal-async-dns-bulk > async.patch
# Or compare online:
# https://github.com/esoup/async-diff/compare/2.9.7...minimal-async-dns-bulkAdd async versions alongside sync methods - never replace them.
# Existing sync method (unchanged API)
def update(self):
import asyncio
asyncio.run(self.update_async())
# New async method (opt-in)
async def update_async(self):
# ... async implementation ...| File | Lines | Purpose |
|---|---|---|
SOLIDserverRest.py |
+184 | Async HTTP client (aiohttp) |
dns_record.py |
+514 | Async CRUD methods |
bulk_dns.py |
+341 | Bulk operations with idempotency (NEW) |
sds.py |
+155/-60 | Async connection management |
| TOTAL | ~860 | Async + idempotency |
from SOLIDserverRest.adv import SDS, DNS_record
from SOLIDserverRest.adv import bulk_update_dns_records, bulk_update_dns_records_idempotent
sds = SDS(ip_address="server", user="admin", pwd="secret")
sds.connect()
# Prepare 300 records
records = []
for record_id in range(1000, 1300):
record = DNS_record(sds=sds, name="temp")
record.myid = record_id
record.refresh()
record.set_ttl(600)
records.append(record)
# Option 1: Update all in parallel
result = bulk_update_dns_records(records, max_concurrent=50)
print(f"✓ {result['succeeded']}/{result['total']}")
# Option 2: Idempotent updates (Ansible-friendly)
records_with_state = [(r, {'ttl': 600}) for r in records]
result = bulk_update_dns_records_idempotent(records_with_state, max_concurrent=50)
print(f"✓ Updated: {result['succeeded']}, Skipped: {result['skipped']}")Performance: Should significantly improve bulk operation performance through parallelization
Idempotency: Ansible-friendly operations that only update when state differs
Compatibility: All existing synchronous code works unchanged
Dependencies: Only adds aiohttp
UNOFFICIAL FORK - Educational/research purposes only. Not endorsed by original library authors. Use at your own risk.
Original library: https://gitlab.com/efficientip/solidserverrest
Maintained by eSoup for internal research.