Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
rename DataFileManager to FileManager (#54)
* rename DataFileManager to FileManager * remove #nextFile() from FileGenerator
- Loading branch information
Showing
5 changed files
with
101 additions
and
93 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2017 HugeGraph Authors | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with this | ||
* work for additional information regarding copyright ownership. The ASF | ||
* licenses this file to You under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package com.baidu.hugegraph.computer.core.store; | ||
|
||
import java.nio.file.Paths; | ||
|
||
public interface FileGenerator { | ||
|
||
/** | ||
* Allocate a base directory each call. There may be multi base | ||
* directories configured by user, generally each base directory | ||
* represent a disk, allocated by round mode. | ||
* | ||
* For example, the base directories configured | ||
* ["/disk1/job_001/container_001", "/disk2/job_001/container_001"]. | ||
* It indicates there are two base directories and each base directory | ||
* for one disk. | ||
* First call returns "/disk1/job_001/container_001", | ||
* second call returns "/disk2/job_001/container_001" | ||
* and third call returns "/disk1/job_001/container_001" and so on in | ||
* round mode. | ||
* | ||
* Note: Can't request a directory and write many files into it, this will | ||
* cause the io pressure can't distributed over several disks. | ||
* | ||
* @return The directory of allocated local base directory. | ||
*/ | ||
String nextDirectory(); | ||
|
||
/** | ||
* Allocate a base directory each call, return allocated base directory + | ||
* joined string of paths. | ||
* | ||
* @param paths The paths as sub-directory. | ||
* @return A string representation of a directory "#nextDirectory() + | ||
* joined string of paths" | ||
*/ | ||
default String nextDirectory(String... paths) { | ||
return Paths.get(this.nextDirectory(), paths).toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters