رموز الحماية (Fencing Tokens)
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
make stale holders harmless.
الموضوعات المخطط لها
- A fencing token is a number that increases every time the lock is granted.
- The holder sends the token with each write; the resource rejects writes with a token lower than one it has seen.
- The check must be at the resource (database, storage), not only in the client.
- In SQL: store
last_tokenand addWHERE last_token <= :tokento the update. - A version column or a monotonically increasing sequence can provide the token.
تفاصيل المخطط المبدئي
عرض عملي
UPDATE recon_state SET last_token = :t, result = :r
WHERE id = 1 AND last_token <= :t; -- 0 rows updated: you are stale, stopاختبر فهمك
Where must the token be checked?
أظهر الإجابة
At the resource being written, not just in the client.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.