X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=draft%2Fman3%2Fbtree.3;h=e704a4044c264ca60053b386301bd640dc00f069;hb=1d98b26905be2ad5ba08a94d65f57d872bae4f85;hp=079bdb01c84fd47f56fd97a2ee1147f7a66069b5;hpb=4098ba44b0a43ff980f70689be7c8ed69230e427;p=linuxjm%2FLDP_man-pages.git diff --git a/draft/man3/btree.3 b/draft/man3/btree.3 index 079bdb01..e704a404 100644 --- a/draft/man3/btree.3 +++ b/draft/man3/btree.3 @@ -31,58 +31,29 @@ .\" .\" @(#)btree.3 8.4 (Berkeley) 8/18/94 .\" -.\" Japanese Version Copyright (c) 1999 Shouichi Saito -.\" all rights reserved. -.\" Translated Mon Jul 26 21:43:11 JST 1999 -.\" by Shouichi Saito -.\" Proofed Mon Aug 16 1999 by NAKANO Takeo +.\"******************************************************************* .\" -.\"WORD: access method ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É -.\"WORD: prefix (comparison) Á°ÃÖÈæ³Ó -.TH BTREE 3 1994-08-18 "" "Linux Programmer's Manual" -.UC 7 -.SH ̾Á° -.\"O btree \- btree database access method -btree \- btree ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤Î¥¢¥¯¥»¥¹¥á¥½¥Ã¥É -.SH ½ñ¼° +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH BTREE 3 1994\-08\-18 "" "Linux Programmer's Manual" +.\".UC 7 +.SH 名前 +btree \- btree データベースへのアクセスメソッド +.SH 書式 .nf -.ft B -#include -#include -.ft R +\fB#include +#include \fP .fi -.SH ÀâÌÀ -.\"O The routine -.\"O .BR dbopen (3) -.\"O is the library interface to database files. -¥ë¡¼¥Á¥ó -.BR dbopen (3) -¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ç¤¢¤ë¡£ -.\"O One of the supported file formats is btree files. -.\"O The general description of the database access methods is in -.\"O .BR dbopen (3), -.\"O this manual page describes only the btree specific information. -¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¤Ò¤È¤Ä¤Ë btree ¥Õ¥¡¥¤¥ë¤¬¤¢¤ë¡£ -¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤Î¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ë´Ø¤¹¤ë°ìÈÌŪ¤Êµ­½Ò¤Ï -.BR dbopen (3) -¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¡£ -¤³¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ç¤Ï btree ÆÃÍ­¤Î¾ðÊó¤Ë¤Ä¤¤¤Æ¤Î¤ßµ­½Ò¤¹¤ë¡£ +.SH 説明 +ルーチン \fBdbopen\fP(3) はデータベースファイルに対するライブラリインターフェースである。 サポートされているファイルフォーマットのひとつに +btree ファイルがある。 データベースへのアクセスメソッドに関する一般的な記述は \fBdbopen\fP(3) に書かれている。 +このマニュアルページでは btree 特有の情報についてのみ記述する。 .PP -.\"O The btree data structure is a sorted, balanced tree structure storing -.\"O associated key/data pairs. -btree ¥Ç¡¼¥¿¹½Â¤¤Ç¤Ï¡¢¥½¡¼¥È¤µ¤ì¤¿¥Ð¥é¥ó¥¹¥Ä¥ê¡¼¹½Â¤¤Ë -¸ß¤¤¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿¥­¡¼/¥Ç¡¼¥¿ÂФò³ÊǼ¤·¤Æ¤¤¤ë¡£ +btree データ構造では、ソートされたバランスツリー構造に 互いに関連づけられたキー/データ対を格納している。 .PP -.\"O The btree access method specific data structure provided to -.\"O .BR dbopen (3) -.\"O is defined in the -.\"O .I -.\"O include file as follows: -.BR dbopen (3) -¤ËÅϤµ¤ì¤ë btree ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤ËÆÃÍ­¤Î¥Ç¡¼¥¿¹½Â¤ÂΤϡ¢ -.I -¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤Ç¼¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£ -.sp +\fBdbopen\fP(3) に渡される btree アクセスメソッドに特有のデータ構造体は、 \fI\fP +インクルードファイルで次のように定義されている。 .in +4n .nf @@ -98,98 +69,31 @@ typedef struct { } BTREEINFO; .fi .in -.sp -.\"O The elements of this structure are as follows: -¤³¤Î¹½Â¤ÂΤÎÍ×ÁǤò°Ê²¼¤Ë¼¨¤¹¡£ -.TP -.I flags -.\"O The flag value is specified by ORing any of the following values: -.I flags -¤ÎÃͤϰʲ¼¤ÎÃͤΤ¤¤º¤ì¤«¤«¡¢¤³¤ì¤é¤ÎÏÀÍýϤǻØÄꤵ¤ì¤ë¡£ +.PP +この構造体の要素を以下に示す。 +.TP +\fIflags\fP +\fIflags\fP の値は以下の値の論理和で指定される。 .RS -.TP -.B R_DUP -.\"O Permit duplicate keys in the tree, that is, -.\"O permit insertion if the key to be -.\"O inserted already exists in the tree. -.\"O The default behavior, as described in -.\"O .BR dbopen (3), -.\"O is to overwrite a matching key when inserting a new key or to fail if -.\"O the -.\"O .B R_NOOVERWRITE -.\"O flag is specified. -¥Ä¥ê¡¼¤ÎÃæ¤Ë¥­¡¼¤Î½ÅÊ£¤òµö¤¹¡£¤¹¤Ê¤ï¤Á¥Ä¥ê¡¼¤ÎÃæ¤ËÁÞÆþ¤µ¤ì¤è¤¦¤È¤·¤Æ¤¤¤ë -¥­¡¼¤¬´û¤Ë¸ºß¤·¤Æ¤¤¤Æ¤â¡¢¤½¤ÎÁÞÆþ¤òµö²Ä¤¹¤ë¡£¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï -.BR dbopen (3) -¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ë¡¢¿·¤·¤¤¥­¡¼¤¬ÁÞÆþ¤µ¤ì¤ë¤È°ìÃפ·¤¿¥­¡¼¤ò¾å½ñ¤­¤¹¤ë¡£ -¤¢¤ë¤¤¤Ï -.B R_NOOVERWRITE -¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤ÈÁÞÆþ¤Ë¼ºÇÔ¤¹¤ë¡£ -.\"O The -.\"O .B R_DUP -.\"O flag is overridden by the -.\"O .B R_NOOVERWRITE -.\"O flag, and if the -.\"O .B R_NOOVERWRITE -.\"O flag is specified, attempts to insert duplicate keys into -.\"O the tree will fail. -.B R_DUP -¥Õ¥é¥°¤Ï -.B R_NOOVERWRITE -¥Õ¥é¥°¤Ë¤è¤Ã¤Æ¾å½ñ¤­¤µ¤ì¤ë¡£¤Ä¤Þ¤ê -.B R_NOOVERWRITE -¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢¥Ä¥ê¡¼¤ËÊ£À½¥­¡¼¤òÁÞÆþ¤·¤è¤¦¤È¤¹¤ë¤È¼ºÇÔ¤¹¤ë¡£ +.TP +\fBR_DUP\fP +ツリーの中にキーの重複を許す。すなわちツリーの中に挿入されようとしている キーが既に存在していても、その挿入を許可する。デフォルトの動作は +\fBdbopen\fP(3) に記述されているように、新しいキーが挿入されると一致したキーを上書きする。 あるいは \fBR_NOOVERWRITE\fP +フラグが指定されていると挿入に失敗する。 \fBR_DUP\fP フラグは \fBR_NOOVERWRITE\fP フラグによって上書きされる。つまり +\fBR_NOOVERWRITE\fP フラグが指定された場合、ツリーに複製キーを挿入しようとすると失敗する。 .IP -.\"O If the database contains duplicate keys, the order of retrieval of -.\"O key/data pairs is undefined if the -.\"O .I get -.\"O routine is used, however, -.\"O .I seq -.\"O routine calls with the -.\"O .B R_CURSOR -.\"O flag set will always return the logical -.\"O "first" of any group of duplicate keys. -¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¥­¡¼¤Î½ÅÊ£¤¬¤¢¤ë¤È¡¢ -.I get -¥ë¡¼¥Á¥ó¤ò»È¤Ã¤¿¾ì¹ç¤Î¥­¡¼/¥Ç¡¼¥¿ÂФμèÆÀ½ç¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£¤½¤ì¤ËÂФ·¡¢ -.B R_CURSOR -¥Õ¥é¥°¤ò¥»¥Ã¥È¤·¤Æ -.I seq -¥ë¡¼¥Á¥ó¤ò»È¤¦¤È¡¢Ê£À½¥­¡¼¤Î¥°¥ë¡¼¥×¤ÎÃæ¤Î -ÏÀÍýŪ¤Ë¡ÖºÇ½é¡×¤Î¥­¡¼¤òɬ¤ºÊÖ¤·¤Æ¤¯¤ë¡£ +データベースにキーの重複があると、 \fIget\fP ルーチンを使った場合のキー/データ対の取得順は未定義である。それに対し、 \fBR_CURSOR\fP +フラグをセットして \fIseq\fP ルーチンを使うと、複製キーのグループの中の 論理的に「最初」のキーを必ず返してくる。 .RE -.TP -.I cachesize -.\"O A suggested maximum size (in bytes) of the memory cache. -ÁÛÄꤵ¤ì¤ë¥á¥â¥ê¥­¥ã¥Ã¥·¥å¤ÎºÇÂ祵¥¤¥º (¥Ð¥¤¥Èñ°Ì)¡£ -.\"O This value is -.\"O .I only -.\"O advisory, and the access method will allocate more memory rather than fail. -.\"O Since every search examines the root page of the tree, caching the most -.\"O recently used pages substantially improves access time. -¤³¤ÎÃÍ¤Ï -.I ¤¢¤¯¤Þ¤Ç -»²¹Í¤Ç¤¢¤ê¡¢¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ï¤³¤ÎÃͤò±Û¤¨¤¿¥á¥â¥ê¤Î -³ä¤êÅö¤Æ¤ËÀ®¸ù¤¹¤ë¤³¤È¤â¤¢¤ë¡£ -.\"O In addition, physical writes are delayed as long as possible, so a moderate -.\"O cache can reduce the number of I/O operations significantly. -²Ã¤¨¤Æ¡¢ÊªÍýŪ¤Ê½ñ¤­¹þ¤ß¤Ï²Äǽ¤Ê¸Â¤êÃٱ䤵¤ì¤ë¤Î¤Ç¡¢ -¥­¥ã¥Ã¥·¥å¤ÎÂ礭¤µ¤òŬÅ٤ˤ·¤Æ¤ª¤±¤Ð I/O Áàºî¤Î²ó¿ô¤ò¤«¤Ê¤ê¸º¤é¤¹¤³¤È -¤¬¤Ç¤­¤ë¡£ -.\"O Obviously, using a cache increases (but only increases) the likelihood of -.\"O corruption or lost data if the system crashes while a tree is being modified. -¤¢¤­¤é¤«¤Ë¥­¥ã¥Ã¥·¥å¤ò»È¤¦¤È¡¢¥Ä¥ê¡¼¤¬Êѹ¹¤µ¤ì¤Æ¤¤¤ëÅÓÃæ¤Ç -¥·¥¹¥Æ¥à¤¬¥¯¥é¥Ã¥·¥å¤·¤¿¾ì¹ç¤Î¥Ç¡¼¥¿Ç˲õ¤ä¥Ç¡¼¥¿¥í¥¹¥È¤Î²ÄǽÀ­¤Ï -Áý¤¨¤ë (¤Þ¤¢¤Ç¤â¤½¤ì¤À¤±¤Î¤³¤È)¡£ -.\"O If -.I cachesize -.\"O is 0 (no size is specified) a default cache is used. -¤¬ 0 (¥µ¥¤¥º¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢¥Ç¥Õ¥©¥ë¥È¤Î¥­¥ã¥Ã¥·¥å¤¬»È¤ï¤ì¤ë¡£ -.TP -.I maxkeypage -.\"O The maximum number of keys which will be stored on any single page. -.\"O Not currently implemented. -ñ°ì¥Ú¡¼¥¸¤ËǼ¤á¤é¤ì¤ëºÇÂ祭¡¼¿ô¤Ç¤¢¤ë¡£¸½ºß¼ÂÁõ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£ +.TP +\fIcachesize\fP +想定されるメモリキャッシュの最大サイズ (バイト単位)。 この値は \fIあくまで\fP 参考であり、アクセスメソッドはこの値を越えたメモリの +割り当てに成功することもある。 加えて、物理的な書き込みは可能な限り遅延されるので、 キャッシュの大きさを適度にしておけば I/O +操作の回数をかなり減らすこと ができる。 あきらかにキャッシュを使うと、ツリーが変更されている途中で +システムがクラッシュした場合のデータ破壊やデータロストの可能性は 増える (まあでもそれだけのこと)。 \fIcachesize\fP が 0 +(サイズが指定されていない) の場合、デフォルトのキャッシュが使われる。 +.TP +\fImaxkeypage\fP .\" The maximum number of keys which will be stored on any single page. .\" Because of the way the btree data structure works, .\" .I maxkeypage @@ -198,171 +102,60 @@ typedef struct { .\" .I maxkeypage .\" is 0 (no maximum number of keys is specified) the page fill factor is .\" made as large as possible (which is almost invariably what is wanted). -.TP -.I minkeypage -.\"O The minimum number of keys which will be stored on any single page. -.\"O This value is used to determine which keys will be stored on overflow -.\"O pages, that is, if a key or data item is longer than the pagesize divided -.\"O by the minkeypage value, it will be stored on overflow pages instead -.\"O of in the page itself. -ñ°ì¥Ú¡¼¥¸¤ËǼ¤á¤é¤ì¤ëºÇ¾®¥­¡¼¿ô¤Ç¤¢¤ë¡£¤³¤ÎÃͤϡ¢¤É¤Î¥­¡¼¤ò -¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Ú¡¼¥¸ -¤ËǼ¤á¤ë¤«·è¤á¤ë¤Î¤Ë»È¤ï¤ì¤ë¡£¤¹¤Ê¤ï¤Á¥­¡¼¤Þ¤¿¤Ï¥Ç¡¼¥¿¤¬ -minkeypage ¤ÎÃͤÇʬ³ä¤µ¤ì¤¿¥Ú¡¼¥¸¥µ¥¤¥º¤è¤êÂ礭¤¤»þ¡¢¤½¤Î¥Ú¡¼¥¸¤ËǼ¤á -¤ëÂå¤ï¤ê¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Ú¡¼¥¸¤ËǼ¤á¤ë¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£ -.\"O If -.I minkeypage -.\"O is 0 (no minimum number of keys is specified) a value of 2 is used. -¤¬ 0 (¥­¡¼¤ÎºÇ¾®Ãͤ¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢ÃͤȤ·¤Æ 2 ¤¬»È¤ï¤ì¤ë¡£ -.TP -.I psize -.\"O Page size is the size (in bytes) of the pages used for nodes in the tree. -.\"O The minimum page size is 512 bytes and the maximum page size is 64K. -¥Ä¥ê¡¼¤ÎÃæ¤Î¥Î¡¼¥É¤Ë»È¤ï¤ì¤ë¥Ú¡¼¥¸¥µ¥¤¥º (¥Ð¥¤¥Èñ°Ì)¡£ -ºÇ¾®ÃÍ¤Ï 512 ¥Ð¥¤¥È¤Ç¡¢ºÇÂçÃÍ¤Ï 64K ¤Ç¤¢¤ë¡£ -.\"O If -.I psize -.\"O is 0 (no page size is specified) a page size is chosen based on the -.\"O underlying file system I/O block size. -¤¬ 0 (¥Ú¡¼¥¸¥µ¥¤¥º¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢ -¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î I/O ¥Ö¥í¥Ã¥¯¥µ¥¤¥º¤Ë´ð¤Å¤¤¤Æ·è¤á¤é¤ì¤ë¡£ -.TP -.I compare -.\"O Compare is the key comparison function. -.I compare -¤Ï¥­¡¼¤ÎÈæ³Ó´Ø¿ô¤Ç¤¢¤ë¡£ -.\"O It must return an integer less than, equal to, or greater than zero if the -.\"O first key argument is considered to be respectively less than, equal to, -.\"O or greater than the second key argument. -ºÇ½é¤Î¥­¡¼°ú¿ô¤ËÂФ·¡¢ÆóÈÖÌܤΥ­¡¼°ú¿ô¤¬Â礭¤¤¾ì¹ç¤Ë¤ÏÀµ¤ÎÀ°¿ô¤ò¡¢ -Ʊ¤¸¾ì¹ç¤Ë¤Ï¥¼¥í¤ò¡¢¾®¤µ¤¤¾ì¹ç¤Ë¤ÏÉé¤ÎÀ°¿ô¤òÊÖ¤¹¡£ -.\"O The same comparison function must be used on a given tree every time it -.\"O is opened. -¥Ä¥ê¡¼¤ò³«¤¯ºÝ¤Ë¤Ï¡¢¾ï¤ËƱ¤¸Èæ³Ó´Ø¿ô¤¬»È¤ï¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ -.\"O If -.I compare -.\"O is NULL (no comparison function is specified), the keys are compared -.\"O lexically, with shorter keys considered less than longer keys. -¤¬ NULL (Èæ³Ó´Ø¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢ -¼­½ñŪ¤ËÈæ³Ó¤µ¤ì¤ë¡£Ã»¤¤¥­¡¼¤ÏŤ¤¥­¡¼¤è¤ê¾®¤µ¤¤¤³¤È¤Ë¤Ê¤ë¡£ -.TP -.I prefix -.\"O Prefix is the prefix comparison function. -.I prefix -¤ÏÁ°ÃÖÈæ³Ó´Ø¿ô¤Ç¤¢¤ë¡£ -.\"O If specified, this routine must return the number of bytes of the second key -.\"O argument which are necessary to determine that it is greater than the first -.\"O key argument. -¤³¤Î¥ë¡¼¥Á¥ó¤Ï (»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï)¡¢ÆóÈÖÌܤΥ­¡¼°ú¿ô¤Î -¥Ð¥¤¥È¿ô¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¤³¤ì¤ÏÆóÈÖÌܤΥ­¡¼°ú¿ô¤¬ -°ìÈÖÌܤΥ­¡¼°ú¿ô¤è¤êÂ礭¤¤¤«¤É¤¦¤«·è¤á¤ë¤Î¤ËɬÍפǤ¢¤ë¡£ -.\"NAKANO ¤Á¤ç¤Ã¤È°ÕÌ£¤ï¤«¤é¤ó... -.\"O If the keys are equal, the key length should be returned. -.\"O Note, the usefulness of this routine is very data-dependent, but, in some -.\"O data sets can produce significantly reduced tree sizes and search times. -¥­¡¼¤¬Æ±¤¸¾ì¹ç¡¢¥­¡¼¤ÎŤµ¤¬Ê֤롣¤³¤Î¥ë¡¼¥Á¥ó¤¬Í­ÍѤ«¤É¤¦¤«¤Ï¡¢ -¥Ç¡¼¥¿¤Ë¶¯¤¯°Í¸¤¹¤ë¡£¤·¤«¤·¥Ç¡¼¥¿¥»¥Ã¥È¤Ë¤è¤Ã¤Æ¤Ï¡¢ÌÀ¤é¤«¤Ë¥Ä¥ê¡¼ -¤Î¥µ¥¤¥º¤È¸¡º÷»þ´Ö¤ò¸º¤é¤·¤Æ¤¯¤ì¤ë¡£ -.\"O If -.\"O .I prefix -.\"O is NULL (no prefix function is specified), -.\"O .I and -.\"O no comparison function is specified, a default lexical comparison routine -.\"O is used. -.I prefix -¤¬ NULL (prefix ´Ø¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Ç¡¢ -.I ¤«¤Ä -Èæ³Ó´Ø¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤È¡¢¥Ç¥Õ¥©¥ë¥È¤Î¼­½ñÈæ³Ó¥ë¡¼¥Á¥ó¤¬»È¤ï¤ì¤ë¡£ -.\"O If -.\"O .I prefix -.\"O is NULL and a comparison routine is specified, no prefix comparison is -.\"O done. -.I prefix -¤¬ NULL ¤ÇÈæ³Ó´Ø¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢Á°ÃÖÈæ³Ó¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£ -.TP -.I lorder -.\"O The byte order for integers in the stored database metadata. -.\"O The number should represent the order as an integer; for example, -.\"O big endian order would be the number 4,321. -.\"O If -.\"O .I lorder -.\"O is 0 (no order is specified) the current host order is used. -¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤ë¥á¥¿¥Ç¡¼¥¿¤ÎÀ°¿ôÃͤΥХ¤¥È¥ª¡¼¥À¡¼¡£ -¤³¤Î¿ô»ú¤Ï¡¢½ç½ø¤òÀ°¿ô¤Çɽ¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£ -Î㤨¤Ð¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ê¤é¡¢¤³¤Î¿ôÃÍ¤Ï 4,321 ¤È¤Ê¤ë¡£ -.I lorder -¤¬ 0 (»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢¸½ºß¤Î¥Û¥¹¥È -¤Ç»È¤ï¤ì¤Æ¤¤¤ë¥Ð¥¤¥È¥ª¡¼¥À¡¼¤¬»È¤ï¤ì¤ë¡£ +単一ページに納められる最大キー数である。現在実装されていない。 +.TP +\fIminkeypage\fP +単一ページに納められる最小キー数である。この値は、どのキーを オーバーフローページ に納めるか決めるのに使われる。すなわちキーまたはデータが +minkeypage の値で分割されたページサイズより大きい時、そのページに納め る代わりにオーバーフローページに納めるということである。 +\fIminkeypage\fP が 0 (キーの最小値が指定されていない) の場合、値として 2 が使われる。 +.TP +\fIpsize\fP +ツリーの中のノードに使われるページサイズ (バイト単位)。 最小値は 512 バイトで、最大値は 64K である。 \fIpsize\fP が 0 +(ページサイズが指定されていない) の場合、 ファイルシステムの I/O ブロックサイズに基づいて決められる。 +.TP +\fIcompare\fP +\fIcompare\fP はキーの比較関数である。 最初のキー引数に対し、二番目のキー引数が大きい場合には正の整数を、 +同じ場合にはゼロを、小さい場合には負の整数を返す。 ツリーを開く際には、常に同じ比較関数が使われなければならない。 \fIcompare\fP が NULL +(比較関数が指定されていない) の場合、 辞書的に比較される。短いキーは長いキーより小さいことになる。 +.TP +\fIprefix\fP +\fIprefix\fP は前置比較関数である。 このルーチンは (指定された場合には)、二番目のキー引数の +バイト数を返さなくてはならない。これは二番目のキー引数が 一番目のキー引数より大きいかどうか決めるのに必要である。 +キーが同じ場合、キーの長さが返る。このルーチンが有用かどうかは、 データに強く依存する。しかしデータセットによっては、明らかにツリー +のサイズと検索時間を減らしてくれる。 \fIprefix\fP が NULL (prefix 関数が指定されていない) で、 \fIかつ\fP +比較関数が指定されていないと、デフォルトの辞書比較ルーチンが使われる。 \fIprefix\fP が NULL +で比較関数が指定されている場合は、前置比較は行われない。 +.TP +\fIlorder\fP +データベースに格納されているメタデータの整数値のバイトオーダー。 この数字は、順序を整数で表したものである。 例えばビッグエンディアンなら、この数値は +4,321 となる。 \fIlorder\fP が 0 (指定されていない) の場合、現在のホスト で使われているバイトオーダーが使われる。 .PP -.\"O If the file already exists (and the -.\"O .B O_TRUNC -.\"O flag is not specified), the -.\"O values specified for the arguments -.\"O .IR flags , -.\"O .I lorder -.\"O and -.\"O .I psize -.\"O are ignored -.\"O in favor of the values used when the tree was created. -¥Õ¥¡¥¤¥ë¤¬´û¤Ë¸ºß¤·¤Æ¤¤¤ë (¤Þ¤¿¤Ï -.B O_TRUCT -¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤È¡¢ -°ú¤­¿ô -.IR flag , -.IR lorder , -.I psize -¤Ë»ØÄꤵ¤ì¤¿ÃͤÏ̵»ë¤µ¤ì¡¢ -¥Ä¥ê¡¼¤¬ºî¤é¤ì¤¿»þ¤Ë»È¤Ã¤¿Ãͤ¬ÍѤ¤¤é¤ì¤ë¡£ +ファイルが既に存在している (または \fBO_TRUCT\fP フラグが指定されていない) と、 引き数 \fIflag\fP, \fIlorder\fP, +\fIpsize\fP に指定された値は無視され、 ツリーが作られた時に使った値が用いられる。 .PP -.\"O Forward sequential scans of a tree are from the least key to the greatest. -¥Ä¥ê¡¼¤ÎÁ°Êý½ç¸¡º÷¤Ï¡¢ºÇ¾®¥­¡¼¤«¤éºÇÂ祭¡¼¤Ë¸þ¤«¤Ã¤Æ¹Ô¤ï¤ì¤ë¡£ +ツリーの前方順検索は、最小キーから最大キーに向かって行われる。 .PP -.\"O Space freed up by deleting key/data pairs from the tree is never reclaimed, -.\"O although it is normally made available for reuse. -.\"O This means that the btree storage structure is grow-only. -.\"O The only solutions are to avoid excessive deletions, or to create a fresh -.\"O tree periodically from a scan of an existing one. -¥Ä¥ê¡¼¤«¤é¥­¡¼/¥Ç¡¼¥¿ÂФ¬ºï½ü¤µ¤ì¤ë¤³¤È¤Ë¤è¤Ã¤Æ¤Ç¤­¤¿¥¹¥Ú¡¼¥¹¤Ï¡¢ -Ä̾ïºÆÍøÍѤǤ­¤ë·Á¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤¬ºÆÍøÍѤµ¤ì¤ë¤³¤È¤Ï̵¤¤¡£ -¤Ä¤Þ¤ê brtee µ­²±¹½Â¤¤ÏÈîÂ礹¤ë°ìÊý¤Ç¤¢¤ë¡£ -Âкö¤Ï²áÅ٤κï½ü¤òÈò¤±¤ë¤«¡¢ -¸ºß¤¹¤ë¥Ä¥ê¡¼¤òÄ´¤Ù¤ÆÄê´üŪ¤Ë¿·¤·¤¤¥Ä¥ê¡¼¤òºî¤ë¤«¡¢¤À¤±¤Ç¤¢¤ë¡£ +ツリーからキー/データ対が削除されることによってできたスペースは、 通常再利用できる形になっているが再利用されることは無い。 つまり brtee +記憶構造は肥大する一方である。 対策は過度の削除を避けるか、 存在するツリーを調べて定期的に新しいツリーを作るか、だけである。 .PP -.\"O Searches, insertions, and deletions in a btree will all complete in -.\"O O lg base N where base is the average fill factor. -.\"O Often, inserting ordered data into btrees results in a low fill factor. -.\"O This implementation has been modified to make ordered insertion the best -.\"O case, resulting in a much better than normal page fill factor. -.SH ¥¨¥é¡¼ -.\"O The -.\"O .I btree -.\"O access method routines may fail and set -.\"O .I errno -.\"O for any of the errors specified for the library routine -.\"O .BR dbopen (3). -.I btree -¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¥ë¡¼¥Á¥ó¤Ï¼ºÇÔ¤¹¤ë¤È¡¢¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó -.BR dbopen (3) -¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Î¤¤¤º¤ì¤«¤ò -.I errno -¤È¤·¤ÆÊÖ¤¹¡£ -.\"O .SH BUGS -.SH ¥Ð¥° -.\"O Only big and little endian byte order is supported. -¥Ð¥¤¥È¥ª¡¼¥À¡¼¤È¤·¤Æ¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤È¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Î¤ß¤¬ -¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£ -.SH ´ØÏ¢¹àÌÜ -.BR dbopen (3), -.BR hash (3), -.BR mpool (3), -.BR recno (3) +Searches, insertions, and deletions in a btree will all complete in O lg +base N where base is the average fill factor. Often, inserting ordered data +into btrees results in a low fill factor. This implementation has been +modified to make ordered insertion the best case, resulting in a much better +than normal page fill factor. +.SH エラー +\fIbtree\fP アクセスメソッドルーチンは失敗すると、ライブラリルーチン \fBdbopen\fP(3) で定義されているエラーのいずれかを +\fIerrno\fP として返す。 +.SH バグ +バイトオーダーとしてはビッグエンディアンとリトルエンディアンのみが サポートされている。 +.SH 関連項目 +\fBdbopen\fP(3), \fBhash\fP(3), \fBmpool\fP(3), \fBrecno\fP(3) .sp -.IR "The Ubiquitous B-tree" , -Douglas Comer, ACM Comput. Surv. 11, 2 (June 1979), 121-138. +\fIThe Ubiquitous B\-tree\fP, Douglas Comer, ACM Comput. Surv. 11, 2 (June +1979), 121\-138. .sp -.IR "Prefix B-trees" , -Bayer and Unterauer, ACM Transactions on Database Systems, Vol. 2, 1 -(March 1977), 11-26. +\fIPrefix B\-trees\fP, Bayer and Unterauer, ACM Transactions on Database +Systems, Vol. 2, 1 (March 1977), 11\-26. .sp -.IR "The Art of Computer Programming Vol. 3: Sorting and Searching" , -D.E. Knuth, 1968, pp 471-480. +\fIThe Art of Computer Programming Vol. 3: Sorting and Searching\fP, +D.E. Knuth, 1968, pp 471\-480.