Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
Zope Object Database (ZODB) – Python объектілерін ашық түрде және тұрақты сақтауға арналған объектіге бағытталған деректер базасы. Ол Zope веб-қосымша серверінің құрамына кіреді, бірақ Zope-тан тәуелсіз де қолданылуы мүмкін. ZODB мүмкіндіктері: транзакциялар, тарих/кері қайтару, ашық түрде қосылатын сақтағыш, ендірілген кэштеу, көп нұсқалы бір мезгілде басқару (MVCC) және желідегі кеңейтімділік (қолдану арқылы).
The Zope Object Database (ZODB) is an object oriented database for transparently and persistently storing Python objects. It is included as part of the Zope web application server, but can also be used independently of Zope. Features of the ZODB include: transactions, history/undo, transparently pluggable storage, built in caching, multiversion concurrency control (MVCC), and scalability across a network (using ).
Негізгі білім
ZODB Python объектілерін Python-ның кіріктірілген объектілерді сақтау механизмінің (pickle) кеңейтілген нұсқасын қолдана отырып сақтайды. ZODB дерекқорының бір түбірлік объектісі болады (әдетте сөздік), және дерекқор осы объектіге ғана тікелей қол жеткізуді қамтамасыз етеді. Дерекқорда сақталған барлық басқа объектілерге түбірлік объекті арқылы жетеді. Дерекқорда сақталған объектілер сілтеме жасайтын объектілер де автоматты түрде дерекқорда сақталады. ZODB MVCC қолданысын пайдалана отырып, бір уақытта жүзеге асырылатын транзакцияларды қолдайды және әрбір объект бойынша өзгерістерді қадағалайды. Тек өзгертілген объектілер ғана тіркеледі. Транзакциялар әдепкі бойынша бұзбалық емес және кері қайтарылуы мүмкін.
ZODB stores Python objects using an extended version of Python's built in object persistence (pickle). A ZODB database has a single root object (normally a dictionary), which is the only object directly made accessible by the database. All other objects stored in the database are reached through the root object. Objects referenced by an object stored in the database are automatically stored in the database as well. ZODB supports concurrent transactions using MVCC and tracks changes to objects on a per object basis. Only changed objects are committed. Transactions are non destructive by default and can be reverted.
Сақтау бірлігі
Тұрақтылықты қамтамасыз ету үшін Python-дағы Car класы тұрақтылықтан (persistence) алынуы керек. Тұрақты сынып – бұл сынып тұрақтылық механизмінің жұмыс істеуі үшін қажетті деректерді, мысалы, ішкі объектінің идентификаторы, объектінің күйі және т.б. сақтайды, сонымен қатар тұрақтылықтың шекарасын былай анықтайды: Persistent класынан алынған әрбір объекті – сақтаудың атомдық бірлігі (көрсеткіштердің графигі арқылы өтетін өзгерістер емес, егер бір сала өзгерсе, бүкіл объект сақтауға көшіріледі). Мысалы, егер Car – Persistent-тен алынған жалғыз сынып болса, wheel3 Car-ға қосылғанда барлық объектілер сақтау құралына жазылуы керек. Керісінше, егер Wheel де Persistent-тен алынса, carzz.wheel3 = Wheel орындалғанда, Car-дың жаңа мәнін сақтау үшін сақтау орнына жаңа жазба жазылады, бірақ бұрынғы Wheel сақталады, ал Car-дың жаңа жазбасы сақтау орнындағы Wheel-дің бұрыннан бар жазбасына сілтеме жасайды. ZODB механизмі көрсеткіштер графигі арқылы өзгерістерді іздемейді. Мысалда, carzz.wheel3 = something өзгерісі ZODB механизмімен автоматты түрде қадағаланады, өйткені carzz (Persistent) Car класына жатады. ZODB механизмі бұл жазбаны «өзгерген» деп белгілейді. Дегенмен, тізім болса, тізімдегі кез келген өзгеріс ZODB механизміне байқаусыз өтеді, сондықтан бағдарламашы carzz.p өзгерді = 1 деп қолмен қосып, ZODB-ге жазбаның шын мәнінде өзгергенін хабарлауы керек. Осылайша, бағдарламашы тұрақтылық механизмінің жұмыс істеу принципін білуі қажет.
For persistence to take place, the Python Car class must be derived from the persistence. Persistent class — this class both holds the data necessary for the persistence machinery to work, such as the internal object id, state of the object, and so on, but also defines the boundary of the persistence in the following sense: every object whose class derives from Persistent is the atomic unit of storage (the whole object is copied to the storage when a field is modified). In the example above, if Car is the only class deriving from Persistent, when wheel3 is added to car, all of the objects must be written to the storage. In contrast, if Wheel also derives from Persistent, then when carzz. wheel3 = Wheel is performed, a new record is written to the storage to hold the new value of the Car, but the existing Wheel are kept, and the new record for the Car points to the already existing Wheel record inside the storage. The ZODB machinery doesn't chase modification down through the graph of pointers. In the example above, carzz. wheel3 = something is a modification automatically tracked down by the ZODB machinery, because carzz is of (Persistent) class Car. The ZODB machinery does this by marking the record as dirty. However, if there is a list, any change inside the list isn't noticed by the ZODB machinery, and the programmer must help by manually adding carzz. p changed = 1, notifying ZODB that the record actually changed. Thus, to a certain extent the programmer must be aware of the working of the persistence machinery.
Атомдық
Сақтау бірлігі (яғни, Persistent класынан мұраласқан объект) сонымен қатар атомдық бірлік болып табылады. Жоғарыдағы мысалда, егер Cars жалғыз Persistent класы болса, бір жіп дөңгелекті өзгертеді (Car деректемесіне хабарлама жіберу қажет), ал басқа жіп басқа транзакция ішіндегі басқа дөңгелекті өзгертеді, екінші жазу сәтсіз аяқталады. Егер Дөңгелек те Persistent болса, екі дөңгелекті екі түрлі транзакциядағы екі түрлі жіп арқылы тәуелсіз түрде өзгертуге болады.
The storage unit (that is, an object whose class derives from Persistent) is also the atomicity unit. In the example above, if Cars is the only Persistent class, a thread modifies a Wheel (the Car record must be notified), and another thread modifies another Wheel inside another transaction, the second commit will fail. If Wheel is also Persistent, both Wheels can be modified independently by two different threads in two different transactions.
Сыныптың тұрақтылығы
Сыныптың тұрақтылығы — нақты бір объектінің класын сақтау құрылғысына жазу — кластың әрбір жазбасына «толыққанды» атауын жазу арқылы қамтамасыз етіледі. Python-да кластың атауы, кластың бастапқы коды орналасқан каталогтардың иерархиясын да қамтиды. Осының салдарынан, тұрақты объектінің бастапқы кодының файлын жылжытуға болмайды. Егер жылжытылса, ZODB жүйесі сақтаудан объектіні алған кезде оның класын анықтай алмайды, нәтижесінде бұзылған объекті пайда болады.
The class persistence—writing the class of a particular object into the storage—is obtained by writing a kind of "fully qualified" name of the class into each record on the disk. In Python, the name of the class involves the hierarchy of directory the source file of the class resides in. A consequence is that the source file of persisting object cannot be moved. If it is, the ZODB machinery is unable to locate the class of an object when retrieving it from the storage, resulting into a broken object.
ЗEO
Zope Enterprise Objects (ZEO) — бірнеше клиенттік процестерге бір ZEO серверінде объектілерді сақтауға мүмкіндік беретін ZODB сақтау жүйесінің іске асырылуы. Бұл көлденең кеңейтуді қамтамасыз етеді.
Zope Enterprise Objects (ZEO) is a ZODB storage implementation that allows multiple client processes to persist objects to a single ZEO server. This allows transparent scaling.
Қосылатын қоймалар
Желілік сақтау (ZEO) Бірнеше Python процестерінің тұрақты инстанцияларды бірден жүктеуіне және сақтауына мүмкіндік береді. Файлдарды сақтау Дискідегі файлмен байланысуға бір Python процесін мүмкіндік береді. relstorage Тұрақты сақтау қоймасын RDBMS ретінде пайдалануға мүмкіндік береді. Каталогтық сақтау Әрбір тұрақты дерек файлдық жүйеде жеке файл ретінде сақталады. Subversion-дағы FSFS-ке ұқсас. Демонстрациялық сақтау Тұрақты сақтау үшін жадтағы қосалқы жүйе. BDBStorage – Berkeley DB қосалқы жүйесін пайдаланады. Қазір қолданылмайды.
Network Storage (aka ZEO) Enables multiple python processes load and store persistent instances concurrently. File Storage Enables a single python process to talk to a file on disk. relstorage Enables the persistence backing store to be a RDBMS. Directory Storage Each persistent data is stored as a separate file on the filesystem. Similar to FSFS in Subversion. Demo Storage An in memory back end for the persistent store. BDBStorage Which uses Berkeley DB back end. Now abandoned.
Ақаулықтарды жою технологиялары
Zope Replication Services (ZRS) Коммерциялық қосымша (2013 жылдың мамыр айынан бастап ашық кодты) бір ғана сәтсіздік нүктесін жояды, жазу операциялары үшін жедел резервтік көшірме ұсынады және оқу операциялары үшін жүктемені бөліп береді. zeoraid Желілік серверлер тізбегі бойынша нысандарды сақтау және қалпына келтіруді бөлісетін прокси желілік серверді ұсынатын ашық кодты шешім. relstorage RDBMS технологиялары қолданылғандықтан, ZEO серверіне қажеттілік туындамайды. NEO Таратылған (қатеге төзімділік, жүктемені теңдестіру) сақтау жүзеге асырылуы.
Zope Replication Services (ZRS) A commercial add on (open source since May 2013) that removes the single point of failure, providing hot backup for writes and load balancing for reads. zeoraid An open source solution that provides a proxy Network Server that distributes object stores and recovery across a series of Network Servers. relstorage since RDBMS technologies are used this obviates need for ZEO server. NEO Distributed (fault tolerance, load balancing) storage implementation.