View Javadoc
1   /*
2    * Copyright (C) 2010, Google Inc. and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  
11  package org.eclipse.jgit.internal.storage.file;
12  
13  import org.eclipse.jgit.lib.Config;
14  import org.eclipse.jgit.lib.Config.SectionParser;
15  import org.eclipse.jgit.lib.CoreConfig;
16  
17  class WriteConfig {
18  	/** Key for {@link Config#get(SectionParser)}. */
19  	static final Config.SectionParser<WriteConfig> KEY = WriteConfig::new;
20  
21  	private final int compression;
22  
23  	private final boolean fsyncObjectFiles;
24  
25  	private final boolean fsyncRefFiles;
26  
27  	private WriteConfig(Config rc) {
28  		compression = rc.get(CoreConfig.KEY).getCompression();
29  		fsyncObjectFiles = rc.getBoolean("core", "fsyncobjectfiles", false); //$NON-NLS-1$ //$NON-NLS-2$
30  		fsyncRefFiles = rc.getBoolean("core", "fsyncreffiles", false); //$NON-NLS-1$ //$NON-NLS-2$
31  	}
32  
33  	int getCompression() {
34  		return compression;
35  	}
36  
37  	boolean getFSyncObjectFiles() {
38  		return fsyncObjectFiles;
39  	}
40  
41  	boolean getFSyncRefFiles() {
42  		return fsyncRefFiles;
43  	}
44  }