⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbis.so

📁 berkeley db 4.6.21的源码。berkeley db是一个简单的数据库管理系统
💻 SO
字号:
m4_comment([$Id: dbis.so,v 10.11 2006/09/19 16:21:42 bostic Exp $])m4_ref_title(Introduction, What is m4_db?,, intro/terrain, intro/dbisnot)m4_p([dnlSo far, we've discussed database systems in general terms. It's timenow to consider m4_db in particular and see how it fits into theframework we have introduced. The key question is, what kinds ofapplications should use m4_db?])m4_p([dnlm4_db is an Open Source embedded database library that providesscalable, high-performance, transaction-protected data managementservices to applications.  m4_db provides a simple function-call API fordata access and management.])m4_p([dnlBy "Open Source," we mean m4_db is distributed under a license thatconforms to the m4_linkweb(http://www.opensource.org/osd.html, [OpenSource Definition]). This license guarantees m4_db is freely availablefor use and redistribution in other Open Source applications.  OracleCorporation sells commercial licenses allowing the redistribution ofm4_db in proprietary applications.  In all cases the complete sourcecode for m4_db is freely available for download and use.])m4_p([dnlm4_db is "embedded" because it links directly into the application.  Itruns in the same address space as the application. As a result, nointer-process communication, either over the network or betweenprocesses on the same machine, is required for database operations.m4_db provides a simple function-call API for a number of programminglanguages, including C, C++, Java, Perl, Tcl, Python, and PHP. Alldatabase operations happen inside the library. Multiple processes, ormultiple threads in a single process, can all use the database at thesame time as each uses the m4_db library. Low-level services likelocking, transaction logging, shared buffer management, memorymanagement, and so on are all handled transparently by the library.])m4_p([dnlThe m4_db library is extremely portable. It runs under almost all UNIXand Linux variants, Windows, and a number of embedded real-timeoperating systems. It runs on both 32-bit and 64-bit systems.  It hasbeen deployed on high-end Internet servers, desktop machines, and onpalmtop computers, set-top boxes, in network switches, and elsewhere.Once m4_db is linked into the application, the end user generally doesnot know that there's a database present at all.])m4_p([dnlm4_db is scalable in a number of respects. The database library itselfis quite compact (under 300 kilobytes of text space on commonarchitectures), but it can manage databases up to 256 terabytes in size.It also supports high concurrency, with thousands of users operating onthe same database at the same time. m4_db is small enough to run intightly constrained embedded systems, but can take advantage ofgigabytes of memory and terabytes of disk on high-end server machines.])m4_p([dnlm4_db generally outperforms relational and object-oriented databasesystems in embedded applications for a couple of reasons. First, becausethe library runs in the same address space, no inter-processcommunication is required for database operations. The cost ofcommunicating between processes on a single machine, or among machineson a network, is much higher than the cost of making a function call.Second, because m4_db uses a simple function-call interface for alloperations, there is no query language to parse, and no execution planto produce.])m4_section([Data Access Services])m4_p([dnlm4_db applications can choose the storage structure that best suits theapplication. m4_db supports hash tables, Btrees, simplerecord-number-based storage, and persistent queues. Programmers cancreate tables using any of these storage structures, and can mixoperations on different kinds of tables in a single application.])m4_p([dnlHash tables are generally good for very large databases that needpredictable search and update times for random-access records.  Hashtables allow users to ask, "Does this key exist?" or to fetch a recordwith a known key.  Hash tables do not allow users to ask for recordswith keys that are close to a known key.])m4_p([dnlBtrees are better for range-based searches, as when the applicationneeds to find all records with keys between some starting and endingvalue.  Btrees also do a better job of exploiting m4_italic([localityof reference]).  If the application is likely to touch keys near eachother at the same time, the Btrees work well. The tree structure keepskeys that are close together near one another in storage, so fetchingnearby values usually doesn't require a disk access.])m4_p([dnlRecord-number-based storage is natural for applications that need tostore and fetch records, but that do not have a simple way to generatekeys of their own. In a record number table, the record number is thekey for the record. m4_db will generate these record numbersautomatically.])m4_p([dnlQueues are well-suited for applications that create records, and thenmust deal with those records in creation order. A good example ison-line purchasing systems. Orders can enter the system at any time,but should generally be filled in the order in which they were placed.])m4_section([Data management services])m4_p([dnlm4_db offers important data management services, including concurrency,transactions, and recovery. All of these services work on all of thestorage structures.])m4_p([dnlMany users can work on the same database concurrently. m4_db handleslocking transparently, ensuring that two users working on the samerecord do not interfere with one another.])m4_p([dnlThe library provides strict ACID transaction semantics, by default.However, applications are allowed to relax the isolation guaranteesthe database system makes.])m4_p([dnlMultiple operations can be grouped into a single transaction, and canbe committed or rolled back atomically. m4_db uses a technique calledm4_italic([two-phase locking]) to be sure that concurrent transactionsare isolated from one another, and a technique calledm4_italic([write-ahead logging]) to guarantee that committed changessurvive application, system, or hardware failures.])m4_p([dnlWhen an application starts up, it can ask m4_db to run recovery.Recovery restores the database to a clean state, with all committedchanges present, even after a crash. The database is guaranteed to beconsistent and all committed changes are guaranteed to be present whenrecovery completes.])m4_p([dnlAn application can specify, when it starts up, which data managementservices it will use. Some applications need fast, single-user,non-transactional Btree data storage. In that case, the application candisable the locking and transaction systems, and will not incur theoverhead of locking or logging. If an application needs to supportmultiple concurrent users, but doesn't need transactions, it can turnon locking without transactions. Applications that need concurrent,transaction-protected database access can enable all of thesubsystems.])m4_p([dnlIn all these cases, the application uses the same function-call API tofetch and update records.])m4_section([Design])m4_p([dnlm4_db was designed to provide industrial-strength database services toapplication developers, without requiring them to become databaseexperts.  It is a classic C-library style m4_italic(toolkit), providinga broad base of functionality to application writers.  m4_db was designedby programmers, for programmers: its modular design surfaces simple,orthogonal interfaces to core services, and it provides mechanism (forexample, good thread support) without imposing policy (for example, theuse of threads is not required).  Just as importantly, m4_db allowsdevelopers to balance performance against the need for crash recoveryand concurrent use.  An application can use the storage structure thatprovides the fastest access to its data and can request only the degreeof logging and locking that it needs.])m4_p([dnlBecause of the tool-based approach and separate interfaces for eachm4_db subsystem, you can support a complete transaction environment forother system operations. m4_db even allows you to wrap transactionsaround the standard UNIX file read and write operations!  Further, m4_dbwas designed to interact correctly with the native system's toolset, afeature no other database package offers.  For example, m4_db supportshot backups (database backups while the database is in use), usingstandard UNIX system utilities, for example, dump, tar, cpio, pax oreven cp.])m4_p([dnlFinally, because scripting language interfaces are available for m4_db(notably Tcl and Perl), application writers can build incredibly powerfuldatabase engines with little effort.  You can build transaction-protecteddatabase applications using your favorite scripting languages, anincreasingly important feature in a world using CGI scripts to deliverHTML.])m4_page_footer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -