Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/DataAccessProvider.java @ 608:e1b29756f901
Clean, organize and resolve some TODOs and FIXMEs: minor refactorings and comments
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Tue, 07 May 2013 21:27:51 +0200 |
| parents | 5daa42067e7c |
| children | 65c01508f002 |
comparison
equal
deleted
inserted
replaced
| 607:66f1cc23b906 | 608:e1b29756f901 |
|---|---|
| 52 private static final int DEFAULT_MAPIO_BUFFER = DEFAULT_MAPIO_LIMIT; // same as default boundary | 52 private static final int DEFAULT_MAPIO_BUFFER = DEFAULT_MAPIO_LIMIT; // same as default boundary |
| 53 | 53 |
| 54 private final int mapioMagicBoundary; | 54 private final int mapioMagicBoundary; |
| 55 private final int bufferSize, mapioBufSize; | 55 private final int bufferSize, mapioBufSize; |
| 56 private final SessionContext context; | 56 private final SessionContext context; |
| 57 // not the right place for the property, but DAP is the only place currently available to RevlogStream to get the value | |
| 58 private final boolean shallMergePatches; | |
| 59 | 57 |
| 60 public DataAccessProvider(SessionContext ctx) { | 58 public DataAccessProvider(SessionContext ctx) { |
| 61 context = ctx; | 59 context = ctx; |
| 62 PropertyMarshal pm = new PropertyMarshal(ctx); | 60 PropertyMarshal pm = new PropertyMarshal(ctx); |
| 63 mapioMagicBoundary = mapioBoundaryValue(pm.getInt(CFG_PROPERTY_MAPIO_LIMIT, DEFAULT_MAPIO_LIMIT)); | 61 mapioMagicBoundary = mapioBoundaryValue(pm.getInt(CFG_PROPERTY_MAPIO_LIMIT, DEFAULT_MAPIO_LIMIT)); |
| 64 bufferSize = pm.getInt(CFG_PROPERTY_FILE_BUFFER_SIZE, DEFAULT_FILE_BUFFER); | 62 bufferSize = pm.getInt(CFG_PROPERTY_FILE_BUFFER_SIZE, DEFAULT_FILE_BUFFER); |
| 65 mapioBufSize = pm.getInt(CFG_PROPERTY_MAPIO_BUFFER_SIZE, DEFAULT_MAPIO_BUFFER); | 63 mapioBufSize = pm.getInt(CFG_PROPERTY_MAPIO_BUFFER_SIZE, DEFAULT_MAPIO_BUFFER); |
| 66 shallMergePatches = pm.getBoolean(Internals.CFG_PROPERTY_PATCH_MERGE, false); | |
| 67 } | 64 } |
| 68 | 65 |
| 69 public DataAccessProvider(SessionContext ctx, int mapioBoundary, int regularBufferSize, int mapioBufferSize) { | 66 public DataAccessProvider(SessionContext ctx, int mapioBoundary, int regularBufferSize, int mapioBufferSize) { |
| 70 context = ctx; | 67 context = ctx; |
| 71 mapioMagicBoundary = mapioBoundaryValue(mapioBoundary); | 68 mapioMagicBoundary = mapioBoundaryValue(mapioBoundary); |
| 72 bufferSize = regularBufferSize; | 69 bufferSize = regularBufferSize; |
| 73 mapioBufSize = mapioBufferSize; | 70 mapioBufSize = mapioBufferSize; |
| 74 shallMergePatches = new PropertyMarshal(ctx).getBoolean(Internals.CFG_PROPERTY_PATCH_MERGE, false); | 71 } |
| 75 } | 72 |
| 76 | |
| 77 // TODO [post-1.1] find a better place for this option, it's unrelated to the DAP | |
| 78 public boolean shallMergePatches() { | |
| 79 return shallMergePatches; | |
| 80 } | |
| 81 | |
| 82 // ensure contract of CFG_PROPERTY_MAPIO_LIMIT, for mapioBoundary == 0 use MAX_VALUE so that no file is memmap-ed | 73 // ensure contract of CFG_PROPERTY_MAPIO_LIMIT, for mapioBoundary == 0 use MAX_VALUE so that no file is memmap-ed |
| 83 private static int mapioBoundaryValue(int mapioBoundary) { | 74 private static int mapioBoundaryValue(int mapioBoundary) { |
| 84 return mapioBoundary == 0 ? Integer.MAX_VALUE : mapioBoundary; | 75 return mapioBoundary == 0 ? Integer.MAX_VALUE : mapioBoundary; |
| 85 } | 76 } |
| 86 | 77 |
