Berkeley DB Reference Guide:
Access Methods

PrevRefNext

Flat-text backing files

It is possible to back any Recno database (either fixed or variable length) with a flat-text source file. This provides fast read (and potentially write) access to databases that are normally created and stored as flat-text files. The backing source file may be specified by calling the DB->set_re_source method.

(Recno를 flat-text파일로 저장하는 것이 가능하다.이것은 flat text파일로 생성되고 저장되는 디비의 빠른 읽기,쓰기를 제공한다.DB->set_re_source를 사용하여 backing소스파일을 설정할 수 있다.)

 

The backing source file will be read to initialize the database. In the case of variable length records, the records are assumed to be separated as described for the DB->set_re_delim method. For example, standard UNIX byte stream files can be interpreted as a sequence of variable length records separated by ASCII newline characters. This is the default.

(디비를 초기화기키 위해 backing 소스파일을 읽어들일 것이다.가변길이의 레코드의 경우 레코드는 DB->set_re_delim로 설정된데로 구별된다.예를 들어 표준 유닉스 바이트스트림파일은 뉴라인으로 구별되는 연속적인 가변길이레코드로 해석될수 있다.이것이 디폴트다.)

 

When cached data would normally be written back to the underlying database file (for example, when the DB->close or DB->sync methods are called), the in-memory copy of the database will be written back to the backing source file.

(캐시데이타가 보통 디비파일에 써질때 예를들어 (DB->close or DB->sync methods 가 호출될때)) 디비의 메모리카피는 backing 소스파일에 써진다.

 

The backing source file must already exist (but may be zero-length) when DB->open is called. By default, the backing source file is read lazily, that is, records are not read from the backing source file until they are requested by the application. If multiple processes (not threads) are accessing a Recno database concurrently and either inserting or deleting records, the backing source file must be read in its entirety before more than a single process accesses the database, and only that process should specify the backing source file as part of the DB->open call. This can be accomplished by calling the DB->set_flags method with the DB_SNAPSHOT flag.

(backing 소스파일은 DB->open 호출시 미리 존재해야 한다.디폴트로 backing소스파일은 늦게 읽어진다.즉 레코드는 애프리케이션에서 요청될때 baking소스파일로부터 읽어진다.만약 멀티프로세스(not 쓰레드)가 Recno 디비를 동시에 접근하고 삭입또는 삭제중의 한가지를 수행하면 backing소스파일은 하나의 싱글 프로세스가 에세스하기 전에 전체적으로 읽어져야 하고 오직 하나의 프로세스가 DB->open로 backing소스 파일을 설정한다.이것은 DB->set_flags(DB_SNAPSHOT flag.)로 설정될 수 있다.

 

Reading and writing the backing source file cannot be transactionally protected because it involves filesystem operations that are not part of the Berkeley DB transaction methodology. For this reason, if a temporary database is used to hold the records (a NULL was specified as the file argument to DB->open), it is possible to lose the contents of the backing source file if the system crashes at the right instant. If a permanent file is used to hold the database (a filename was specified as the file argument to DB->open), normal database recovery on that file can be used to prevent information loss. It is still possible that the contents of the backing source file itself will be corrupted or lost if the system crashes.

For all of the above reasons, the backing source file is generally used to specify databases that are read-only for Berkeley DB applications, and that are either generated on the fly by software tools, or modified using a different mechanism such as a text editor.


PrevRefNext

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.