 |
Changeset 154
- Timestamp:
- 06/10/06 20:10:45
(2 years ago)
- Author:
- kris
- Message:
removed superfluous IBitBucket interface
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r131 |
r154 |
|
| 5 | 5 | private import tango.io.Exception, |
|---|
| 6 | 6 | tango.io.FileConduit; |
|---|
| 7 | | |
|---|
| 8 | | private import tango.io.model.IBitBucket; |
|---|
| 9 | 7 | |
|---|
| 10 | 8 | /****************************************************************************** |
|---|
| … | … | |
| 29 | 27 | is a contrived example: |
|---|
| 30 | 28 | |
|---|
| 31 | | @code |
|---|
| | 29 | --- |
|---|
| 32 | 30 | char[] text = "this is a test"; |
|---|
| 33 | 31 | |
|---|
| 34 | | FileBucket bucket = new FileBucket (new FilePath("bucket.bin"), FileBucket.HalfK); |
|---|
| | 32 | auto bucket = new FileBucket (new FilePath("bucket.bin"), FileBucket.HalfK); |
|---|
| 35 | 33 | |
|---|
| 36 | 34 | // insert some data, and retrieve it again |
|---|
| … | … | |
| 39 | 37 | |
|---|
| 40 | 38 | assert (b == text); |
|---|
| 41 | | bucket.close(); |
|---|
| 42 | | @endcode |
|---|
| | 39 | bucket.close; |
|---|
| | 40 | --- |
|---|
| 43 | 41 | |
|---|
| 44 | 42 | ******************************************************************************/ |
|---|
| 45 | 43 | |
|---|
| 46 | | class FileBucket : IBitBucket |
|---|
| | 44 | class FileBucket |
|---|
| 47 | 45 | { |
|---|
| 48 | 46 | /********************************************************************** |
|---|
| … | … | |
| 76 | 74 | |
|---|
| 77 | 75 | // supported block sizes |
|---|
| 78 | | static const BlockSize EighthK = {128-1}, |
|---|
| | 76 | public static const BlockSize EighthK = {128-1}, |
|---|
| 79 | 77 | HalfK = {512-1}, |
|---|
| 80 | 78 | OneK = {1024*1-1}, |
|---|
| … | … | |
| 86 | 84 | SixtyFourK = {1024*64-1}; |
|---|
| 87 | 85 | |
|---|
| | 86 | |
|---|
| | 87 | /********************************************************************** |
|---|
| | 88 | |
|---|
| | 89 | Construct a FileBucket with the provided path and record- |
|---|
| | 90 | size. Selecting a record size that roughly matches the |
|---|
| | 91 | serialized content will limit 'thrashing'. |
|---|
| | 92 | |
|---|
| | 93 | **********************************************************************/ |
|---|
| | 94 | |
|---|
| | 95 | this (char[] path, BlockSize block) |
|---|
| | 96 | { |
|---|
| | 97 | this (new FilePath(path), block); |
|---|
| | 98 | } |
|---|
| | 99 | |
|---|
| 88 | 100 | /********************************************************************** |
|---|
| 89 | 101 | |
|---|
| … | … | |
| 206 | 218 | if (r is null) |
|---|
| 207 | 219 | { |
|---|
| 208 | | Record rr = new Record (); |
|---|
| | 220 | auto rr = new Record; |
|---|
| 209 | 221 | map [key] = rr; |
|---|
| 210 | 222 | r = &rr; |
|---|
| … | … | |
| 239 | 251 | **********************************************************************/ |
|---|
| 240 | 252 | |
|---|
| 241 | | private class Record |
|---|
| | 253 | private static class Record |
|---|
| 242 | 254 | { |
|---|
| 243 | 255 | private ulong offset; |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic