mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-25 21:57:05 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b51d8f03bb | ||
|
|
5a5908407d | ||
|
|
19edd9c091 | ||
|
|
78ea937606 | ||
|
|
53626734d4 | ||
|
|
f71b855db5 | ||
|
|
f14b6a09a8 | ||
|
|
91da7057b1 | ||
|
|
2d43f85577 | ||
|
|
7bc3c93512 | ||
|
|
af1f64d244 | ||
|
|
b10679fcf0 | ||
|
|
2cb1700ecb | ||
|
|
e78ee087e9 | ||
|
|
dcc6b6a3ed | ||
|
|
bf270d9e8c | ||
|
|
2a2d92d06e | ||
|
|
d1d9137e8c | ||
|
|
f7b5a1d697 | ||
|
|
6e776aaafc | ||
|
|
4a5e381feb | ||
|
|
aaf5e658cc | ||
|
|
6c96e51414 | ||
|
|
d2f8e50459 | ||
|
|
5f881d2fd5 | ||
|
|
fee3319cbf | ||
|
|
73bc286377 | ||
|
|
cea52a4faf | ||
|
|
c981975627 | ||
|
|
ae3d08883f | ||
|
|
c446438ca5 | ||
|
|
eae3f27c80 | ||
|
|
d61bb60450 | ||
|
|
470123cdd2 | ||
|
|
2fc2eb74dd | ||
|
|
c22094d340 | ||
|
|
50a5018b7f | ||
|
|
9dc0b1df8f | ||
|
|
be6c2f8511 | ||
|
|
5ebf232e79 | ||
|
|
54768d0761 | ||
|
|
b656e05aaf | ||
|
|
057722bbf4 | ||
|
|
ae2309dc58 | ||
|
|
3d3bab2447 | ||
|
|
af6d9976ad | ||
|
|
a75d50bbb8 | ||
|
|
826bc0b7e3 | ||
|
|
4aa82c95e6 | ||
|
|
eedd33dda3 | ||
|
|
005b4ab3fe | ||
|
|
d1439c5bd3 | ||
|
|
f06ca04451 | ||
|
|
e1911760a7 | ||
|
|
2f5ed29c37 | ||
|
|
2286eda575 | ||
|
|
5463560912 | ||
|
|
34a0d424f8 | ||
|
|
a5ce359999 | ||
|
|
0a05052b5c | ||
|
|
e7e8691720 | ||
|
|
86398d1efe | ||
|
|
1fef598347 | ||
|
|
9e2e07b238 | ||
|
|
cbce793753 | ||
|
|
c763a492f5 | ||
|
|
712720864d | ||
|
|
8d9a76005d | ||
|
|
dd5b582d05 | ||
|
|
7f0d87b206 | ||
|
|
2e4fadd10a | ||
|
|
5c5ddc740d | ||
|
|
966df2ae27 | ||
|
|
6d87a0c5f5 | ||
|
|
5ebc95b69b | ||
|
|
d79f0a76b1 | ||
|
|
d9b56ed88b | ||
|
|
1d918d6d19 | ||
|
|
0dbaa70af2 | ||
|
|
e63a79ade8 | ||
|
|
4d5554b16f | ||
|
|
d83e648c0b | ||
|
|
a875f67a08 | ||
|
|
00d3f01876 | ||
|
|
0820935290 | ||
|
|
49440cbd2f | ||
|
|
0f10833e0b | ||
|
|
3794f2721f | ||
|
|
443b229ef7 | ||
|
|
bb9b97e2b4 | ||
|
|
8047ec2f51 | ||
|
|
782d776d2a | ||
|
|
38e73463f1 | ||
|
|
b51fa81f0e | ||
|
|
e666aeece2 | ||
|
|
d151185b7e | ||
|
|
40601953bf | ||
|
|
daeb18be30 | ||
|
|
b97768c51c | ||
|
|
45ee3736aa | ||
|
|
cddcb5cafe | ||
|
|
f84c288852 | ||
|
|
a5aa8be19b | ||
|
|
7f1e3c843d | ||
|
|
c07bcd5065 | ||
|
|
654a69ff52 | ||
|
|
c0f0fdb3ba | ||
|
|
fbca6b29bd | ||
|
|
b77b4cc3a2 | ||
|
|
e39e78ea8d | ||
|
|
3775211962 | ||
|
|
c16dc57a58 | ||
|
|
d6412f27a0 | ||
|
|
35208711e5 | ||
|
|
e32999108a | ||
|
|
3137777d83 | ||
|
|
0bf148f49d | ||
|
|
bda13ed593 | ||
|
|
74e23e8d64 | ||
|
|
64000f5c45 | ||
|
|
9f2c9b666b | ||
|
|
ae2ee379c0 | ||
|
|
2bdd936fb6 | ||
|
|
e93e986727 | ||
|
|
65d2ea9fb0 | ||
|
|
82bfad5b86 | ||
|
|
6ff9e2835e | ||
|
|
7c111f7b75 | ||
|
|
3b3e063f25 | ||
|
|
d3e4a31058 | ||
|
|
cbfe31a9a8 | ||
|
|
3505b06023 | ||
|
|
4bc19f1e52 | ||
|
|
e1b5ac5c04 | ||
|
|
308688c8d0 | ||
|
|
f251d03673 | ||
|
|
11372dd548 | ||
|
|
c4bea45099 |
No files matched your search
@@ -370,6 +370,7 @@ The architectures are mostly the same. SeaweedFS aims to store and read files fa
|
||||
| SeaweedFS Filer| Linearly Scalable, Customizable | O(1) disk seek | FUSE | Yes | Yes |
|
||||
| GlusterFS | hashing | | FUSE, NFS | | |
|
||||
| Ceph | hashing + rules | | FUSE | Yes | |
|
||||
| MooseFS | in memory | | FUSE | | No |
|
||||
|
||||
[Back to TOC](#table-of-contents)
|
||||
|
||||
@@ -381,6 +382,14 @@ GlusterFS hashes the path and filename into ids, and assigned to virtual volumes
|
||||
|
||||
[Back to TOC](#table-of-contents)
|
||||
|
||||
### Compared to MooseFS ###
|
||||
|
||||
MooseFS chooses to neglect small file issue. From moosefs 3.0 manual, "even a small file will occupy 64KiB plus additionally 4KiB of checksums and 1KiB for the header", because it "was initially designed for keeping large amounts (like several thousands) of very big files"
|
||||
|
||||
MooseFS Master Server keeps all meta data in memory. Same issue as HDFS namenode.
|
||||
|
||||
[Back to TOC](#table-of-contents)
|
||||
|
||||
### Compared to Ceph ###
|
||||
|
||||
Ceph can be setup similar to SeaweedFS as a key->blob store. It is much more complicated, with the need to support layers on top of it. [Here is a more detailed comparison](https://github.com/chrislusf/seaweedfs/issues/120)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
- [4Sight Imaging](https://www.4sightimaging.com/)
|
||||
- [Evercam Camera Management Software](https://evercam.io/)
|
||||
- [Admiral](https://getadmiral.com)
|
||||
|
||||
<h2 align="center">Backers</h2>
|
||||
|
||||
|
||||
+3
-20
@@ -3,44 +3,27 @@
|
||||
case "$1" in
|
||||
|
||||
'master')
|
||||
ARGS="-mdir /data"
|
||||
# Is this instance linked with an other master? (Docker commandline "--link master1:master")
|
||||
if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -peers=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
|
||||
fi
|
||||
ARGS="-mdir=/data -volumePreallocate -volumeSizeLimitMB=1024"
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
'volume')
|
||||
ARGS="-ip `hostname -i` -dir /data"
|
||||
# Is this instance linked with a master? (Docker commandline "--link master1:master")
|
||||
if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -mserver=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
|
||||
fi
|
||||
ARGS="-dir=/data -max=0"
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
'server')
|
||||
ARGS="-ip `hostname -i` -dir /data"
|
||||
if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -master.peers=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
|
||||
fi
|
||||
ARGS="-dir=/data -volume.max=0 -master.volumePreallocate -master.volumeSizeLimitMB=1024"
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
'filer')
|
||||
ARGS=""
|
||||
if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -master=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
|
||||
fi
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
's3')
|
||||
ARGS="-domainName=$S3_DOMAIN_NAME -key.file=$S3_KEY_FILE -cert.file=$S3_CERT_FILE"
|
||||
if [ -n "$FILER_PORT_8888_TCP_ADDR" ] ; then
|
||||
ARGS="$ARGS -filer=$FILER_PORT_8888_TCP_ADDR:$FILER_PORT_8888_TCP_PORT"
|
||||
fi
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ services:
|
||||
ports:
|
||||
- 8080:8080
|
||||
- 18080:18080
|
||||
command: '-v=2 volume -max=5 -mserver="master0:9333,master1:9334,master2:9335" -port=8080 -ip=volume'
|
||||
command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8080 -ip=volume'
|
||||
depends_on:
|
||||
- master0
|
||||
- master1
|
||||
@@ -34,7 +34,7 @@ services:
|
||||
ports:
|
||||
- 8888:8888
|
||||
- 18888:18888
|
||||
command: '-v=4 filer -master="master0:9333,master1:9334,master2:9335"'
|
||||
command: 'filer -master="master0:9333,master1:9334,master2:9335"'
|
||||
depends_on:
|
||||
- master0
|
||||
- master1
|
||||
@@ -44,7 +44,7 @@ services:
|
||||
image: chrislusf/seaweedfs:local
|
||||
ports:
|
||||
- 8333:8333
|
||||
command: '-v=4 s3 -filer="filer:8888"'
|
||||
command: 's3 -filer="filer:8888"'
|
||||
depends_on:
|
||||
- master0
|
||||
- master1
|
||||
|
||||
@@ -12,7 +12,7 @@ services:
|
||||
ports:
|
||||
- 8080:8080
|
||||
- 18080:18080
|
||||
command: '-v=2 volume -max=5 -mserver="master:9333" -port=8080 -ip=volume'
|
||||
command: "volume -mserver=master:9333 -port=8080 -ip=volume"
|
||||
depends_on:
|
||||
- master
|
||||
filer:
|
||||
@@ -20,7 +20,7 @@ services:
|
||||
ports:
|
||||
- 8888:8888
|
||||
- 18888:18888
|
||||
command: '-v=4 filer -master="master:9333"'
|
||||
command: 'filer -master="master:9333"'
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
@@ -28,7 +28,7 @@ services:
|
||||
image: chrislusf/seaweedfs:local
|
||||
ports:
|
||||
- 8333:8333
|
||||
command: '-v=4 s3 -filer="filer:8888"'
|
||||
command: 's3 -filer="filer:8888"'
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
|
||||
@@ -12,7 +12,7 @@ services:
|
||||
ports:
|
||||
- 8080:8080
|
||||
- 18080:18080
|
||||
command: 'volume -max=15 -mserver="master:9333" -port=8080'
|
||||
command: 'volume -mserver="master:9333" -port=8080'
|
||||
depends_on:
|
||||
- master
|
||||
filer:
|
||||
|
||||
@@ -12,7 +12,7 @@ services:
|
||||
ports:
|
||||
- 8080:8080
|
||||
- 18080:18080
|
||||
command: '-v=2 volume -max=5 -mserver="master:9333" -port=8080 -ip=volume'
|
||||
command: 'volume -mserver="master:9333" -port=8080 -ip=volume'
|
||||
depends_on:
|
||||
- master
|
||||
filer:
|
||||
@@ -20,7 +20,7 @@ services:
|
||||
ports:
|
||||
- 8888:8888
|
||||
- 18888:18888
|
||||
command: '-v=4 filer -master="master:9333"'
|
||||
command: 'filer -master="master:9333"'
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
@@ -28,7 +28,7 @@ services:
|
||||
image: chrislusf/seaweedfs:dev # use a remote dev image
|
||||
ports:
|
||||
- 8333:8333
|
||||
command: '-v=4 s3 -filer="filer:8888"'
|
||||
command: 's3 -filer="filer:8888"'
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
|
||||
@@ -70,6 +70,7 @@ require (
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/viper v1.4.0
|
||||
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 // indirect
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/syndtr/goleveldb v1.0.0
|
||||
github.com/tidwall/gjson v1.3.2
|
||||
github.com/tidwall/match v1.0.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: v1
|
||||
description: SeaweedFS
|
||||
name: seaweedfs
|
||||
version: 1.65
|
||||
version: 1.71
|
||||
@@ -4,7 +4,7 @@ global:
|
||||
registry: ""
|
||||
repository: ""
|
||||
imageName: chrislusf/seaweedfs
|
||||
imageTag: "1.65"
|
||||
imageTag: "1.71"
|
||||
imagePullPolicy: IfNotPresent
|
||||
imagePullSecrets: imagepullsecret
|
||||
restartPolicy: Always
|
||||
@@ -107,8 +107,9 @@ volume:
|
||||
# Directories to store data files. dir[,dir]... (default "/tmp")
|
||||
dir: "/data"
|
||||
|
||||
# Maximum numbers of volumes, count[,count]... (default "7")
|
||||
maxVolumes: "10000"
|
||||
# Maximum numbers of volumes, count[,count]...
|
||||
# If set to zero on non-windows OS, the limit will be auto configured. (default "7")
|
||||
maxVolumes: "0"
|
||||
|
||||
# Volume server's rack name
|
||||
rack: null
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.github.chrislusf</groupId>
|
||||
<artifactId>seaweedfs-client</artifactId>
|
||||
<version>1.2.5</version>
|
||||
<version>1.2.6</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package seaweedfs.client;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ChunkCache {
|
||||
|
||||
private final Cache<String, byte[]> cache;
|
||||
|
||||
public ChunkCache(int maxEntries) {
|
||||
this.cache = CacheBuilder.newBuilder()
|
||||
.maximumSize(maxEntries)
|
||||
.expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build();
|
||||
}
|
||||
|
||||
public byte[] getChunk(String fileId) {
|
||||
return this.cache.getIfPresent(fileId);
|
||||
}
|
||||
|
||||
public void setChunk(String fileId, byte[] data) {
|
||||
this.cache.put(fileId, data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,14 +10,14 @@ import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
|
||||
public class SeaweedRead {
|
||||
|
||||
// private static final Logger LOG = LoggerFactory.getLogger(SeaweedRead.class);
|
||||
|
||||
static ChunkCache chunkCache = new ChunkCache(1000);
|
||||
|
||||
// returns bytesRead
|
||||
public static long read(FilerGrpcClient filerGrpcClient, List<VisibleInterval> visibleIntervals,
|
||||
final long position, final byte[] buffer, final int bufferOffset,
|
||||
@@ -57,40 +57,23 @@ public class SeaweedRead {
|
||||
}
|
||||
|
||||
private static int readChunkView(long position, byte[] buffer, int startOffset, ChunkView chunkView, FilerProto.Locations locations) throws IOException {
|
||||
if (chunkView.cipherKey != null) {
|
||||
return readEncryptedChunkView(position, buffer, startOffset, chunkView, locations);
|
||||
|
||||
byte[] chunkData = chunkCache.getChunk(chunkView.fileId);
|
||||
|
||||
if (chunkData == null) {
|
||||
chunkData = doFetchFullChunkData(chunkView, locations);
|
||||
}
|
||||
|
||||
HttpClient client = new DefaultHttpClient();
|
||||
HttpGet request = new HttpGet(
|
||||
String.format("http://%s/%s", locations.getLocations(0).getUrl(), chunkView.fileId));
|
||||
int len = (int) (chunkView.logicOffset - position + chunkView.size);
|
||||
System.arraycopy(chunkData, (int) chunkView.offset, buffer, startOffset, len);
|
||||
|
||||
if (!chunkView.isFullChunk) {
|
||||
request.setHeader(HttpHeaders.ACCEPT_ENCODING, "");
|
||||
request.setHeader(HttpHeaders.RANGE,
|
||||
String.format("bytes=%d-%d", chunkView.offset, chunkView.offset + chunkView.size - 1));
|
||||
}
|
||||
chunkCache.setChunk(chunkView.fileId, chunkData);
|
||||
|
||||
try {
|
||||
HttpResponse response = client.execute(request);
|
||||
HttpEntity entity = response.getEntity();
|
||||
|
||||
int len = (int) (chunkView.logicOffset - position + chunkView.size);
|
||||
OutputStream outputStream = new ByteBufferOutputStream(ByteBuffer.wrap(buffer, startOffset, len));
|
||||
entity.writeTo(outputStream);
|
||||
// LOG.debug("* read chunkView:{} startOffset:{} length:{}", chunkView, startOffset, len);
|
||||
|
||||
return len;
|
||||
|
||||
} finally {
|
||||
if (client instanceof Closeable) {
|
||||
Closeable t = (Closeable) client;
|
||||
t.close();
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
private static int readEncryptedChunkView(long position, byte[] buffer, int startOffset, ChunkView chunkView, FilerProto.Locations locations) throws IOException {
|
||||
private static byte[] doFetchFullChunkData(ChunkView chunkView, FilerProto.Locations locations) throws IOException {
|
||||
|
||||
HttpClient client = new DefaultHttpClient();
|
||||
HttpGet request = new HttpGet(
|
||||
String.format("http://%s/%s", locations.getLocations(0).getUrl(), chunkView.fileId));
|
||||
@@ -122,9 +105,7 @@ public class SeaweedRead {
|
||||
throw new IOException("fail to decrypt", e);
|
||||
}
|
||||
|
||||
int len = (int) (chunkView.logicOffset - position + chunkView.size);
|
||||
System.arraycopy(data, (int) chunkView.offset, buffer, startOffset, len);
|
||||
return len;
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ public class SeaweedWrite {
|
||||
|
||||
String etag = multipartUpload(targetUrl, auth, bytes, bytesOffset, bytesLength, cipherKey);
|
||||
|
||||
// cache fileId ~ bytes
|
||||
SeaweedRead.chunkCache.setChunk(fileId, bytes);
|
||||
|
||||
entry.addChunks(FilerProto.FileChunk.newBuilder()
|
||||
.setFileId(fileId)
|
||||
.setOffset(offset)
|
||||
|
||||
@@ -24,9 +24,6 @@ service SeaweedFiler {
|
||||
rpc DeleteEntry (DeleteEntryRequest) returns (DeleteEntryResponse) {
|
||||
}
|
||||
|
||||
rpc StreamDeleteEntries (stream DeleteEntryRequest) returns (stream DeleteEntryResponse) {
|
||||
}
|
||||
|
||||
rpc AtomicRenameEntry (AtomicRenameEntryRequest) returns (AtomicRenameEntryResponse) {
|
||||
}
|
||||
|
||||
@@ -45,6 +42,9 @@ service SeaweedFiler {
|
||||
rpc GetFilerConfiguration (GetFilerConfigurationRequest) returns (GetFilerConfigurationResponse) {
|
||||
}
|
||||
|
||||
rpc ListenForEvents (ListenForEventsRequest) returns (stream FullEventNotification) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
@@ -233,3 +233,19 @@ message GetFilerConfigurationResponse {
|
||||
string dir_queues = 6;
|
||||
bool cipher = 7;
|
||||
}
|
||||
|
||||
message ListenForEventsRequest {
|
||||
string client_name = 1;
|
||||
string path_prefix = 2;
|
||||
int64 since_ns = 3;
|
||||
}
|
||||
message FullEventNotification {
|
||||
string directory = 1;
|
||||
EventNotification event_notification = 2;
|
||||
}
|
||||
|
||||
message LogEntry {
|
||||
int64 ts_ns = 1;
|
||||
int32 partition_key_hash = 2;
|
||||
bytes data = 3;
|
||||
}
|
||||
@@ -127,7 +127,7 @@
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<seaweedfs.client.version>1.2.5</seaweedfs.client.version>
|
||||
<seaweedfs.client.version>1.2.6</seaweedfs.client.version>
|
||||
<hadoop.version>2.9.2</hadoop.version>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<properties>
|
||||
<seaweedfs.client.version>1.2.5</seaweedfs.client.version>
|
||||
<seaweedfs.client.version>1.2.6</seaweedfs.client.version>
|
||||
<hadoop.version>2.9.2</hadoop.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<seaweedfs.client.version>1.2.5</seaweedfs.client.version>
|
||||
<seaweedfs.client.version>1.2.6</seaweedfs.client.version>
|
||||
<hadoop.version>3.1.1</hadoop.version>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<properties>
|
||||
<seaweedfs.client.version>1.2.5</seaweedfs.client.version>
|
||||
<seaweedfs.client.version>1.2.6</seaweedfs.client.version>
|
||||
<hadoop.version>3.1.1</hadoop.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var (
|
||||
dir = flag.String("dir", ".", "the directory which uses a disk")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
fillInDiskStatus(*dir)
|
||||
|
||||
fmt.Printf("OS: %v\n", runtime.GOOS)
|
||||
fmt.Printf("Arch: %v\n", runtime.GOARCH)
|
||||
|
||||
}
|
||||
|
||||
func fillInDiskStatus(dir string) {
|
||||
fs := syscall.Statfs_t{}
|
||||
err := syscall.Statfs(dir, &fs)
|
||||
if err != nil {
|
||||
fmt.Printf("failed to statfs on %s: %v\n", dir, err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("statfs: %+v\n", fs)
|
||||
fmt.Println()
|
||||
|
||||
total := fs.Blocks * uint64(fs.Bsize)
|
||||
free := fs.Bfree * uint64(fs.Bsize)
|
||||
fmt.Printf("Total: %d blocks x %d block size = %d bytes\n", fs.Blocks, uint64(fs.Bsize), total)
|
||||
fmt.Printf("Free : %d blocks x %d block size = %d bytes\n", fs.Bfree, uint64(fs.Bsize), free)
|
||||
fmt.Printf("Used : %d blocks x %d block size = %d bytes\n", fs.Blocks-fs.Bfree, uint64(fs.Bsize), total-free)
|
||||
fmt.Printf("Free Percentage : %.2f%%\n", float32((float64(free)/float64(total))*100))
|
||||
fmt.Printf("Used Percentage : %.2f%%\n", float32((float64(total-free)/float64(total))*100))
|
||||
return
|
||||
}
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -58,7 +58,7 @@ func walkMetaFile(dst *os.File) error {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Fprintf(os.Stdout, "file %s %v\n", filer2.FullPath(fullEntry.Dir).Child(fullEntry.Entry.Name), fullEntry.Entry.Attributes.String())
|
||||
fmt.Fprintf(os.Stdout, "file %s %v\n", util.FullPath(fullEntry.Dir).Child(fullEntry.Entry.Name), fullEntry.Entry.Attributes.String())
|
||||
for i, chunk := range fullEntry.Entry.Chunks {
|
||||
fmt.Fprintf(os.Stdout, " chunk %d %v\n", i+1, chunk.String())
|
||||
}
|
||||
|
||||
+10
-9
@@ -12,21 +12,22 @@ var Commands = []*Command{
|
||||
cmdBackup,
|
||||
cmdCompact,
|
||||
cmdCopy,
|
||||
cmdFix,
|
||||
cmdFilerReplicate,
|
||||
cmdServer,
|
||||
cmdMaster,
|
||||
cmdFiler,
|
||||
cmdS3,
|
||||
cmdUpload,
|
||||
cmdDownload,
|
||||
cmdExport,
|
||||
cmdFiler,
|
||||
cmdFilerReplicate,
|
||||
cmdFix,
|
||||
cmdMaster,
|
||||
cmdMount,
|
||||
cmdS3,
|
||||
cmdMsgBroker,
|
||||
cmdScaffold,
|
||||
cmdServer,
|
||||
cmdShell,
|
||||
cmdWatch,
|
||||
cmdUpload,
|
||||
cmdVersion,
|
||||
cmdVolume,
|
||||
cmdExport,
|
||||
cmdMount,
|
||||
cmdWebDav,
|
||||
}
|
||||
|
||||
|
||||
@@ -425,7 +425,7 @@ func (worker *FileCopyWorker) uploadFileInChunks(task FileCopyTask, f *os.File,
|
||||
replication = assignResult.Replication
|
||||
}
|
||||
|
||||
uploadResult, err := operation.Upload(targetUrl, fileName+"-"+strconv.FormatInt(i+1, 10), worker.options.cipher, io.NewSectionReader(f, i*chunkSize, chunkSize), false, "", nil, security.EncodedJwt(assignResult.Auth))
|
||||
uploadResult, err, _ := operation.Upload(targetUrl, fileName+"-"+strconv.FormatInt(i+1, 10), worker.options.cipher, io.NewSectionReader(f, i*chunkSize, chunkSize), false, "", nil, security.EncodedJwt(assignResult.Auth))
|
||||
if err != nil {
|
||||
uploadError = fmt.Errorf("upload data %v to %s: %v\n", fileName, targetUrl, err)
|
||||
return
|
||||
|
||||
@@ -9,9 +9,11 @@ type MountOptions struct {
|
||||
replication *string
|
||||
ttlSec *int
|
||||
chunkSizeLimitMB *int
|
||||
chunkCacheCountLimit *int64
|
||||
dataCenter *string
|
||||
allowOthers *bool
|
||||
umaskString *string
|
||||
nonempty *bool
|
||||
outsideContainerClusterMode *bool
|
||||
}
|
||||
|
||||
@@ -31,9 +33,11 @@ func init() {
|
||||
mountOptions.replication = cmdMount.Flag.String("replication", "", "replication(e.g. 000, 001) to create to files. If empty, let filer decide.")
|
||||
mountOptions.ttlSec = cmdMount.Flag.Int("ttl", 0, "file ttl in seconds")
|
||||
mountOptions.chunkSizeLimitMB = cmdMount.Flag.Int("chunkSizeLimitMB", 4, "local write buffer size, also chunk large files")
|
||||
mountOptions.chunkCacheCountLimit = cmdMount.Flag.Int64("chunkCacheCountLimit", 1000, "number of file chunks to cache in memory")
|
||||
mountOptions.dataCenter = cmdMount.Flag.String("dataCenter", "", "prefer to write to the data center")
|
||||
mountOptions.allowOthers = cmdMount.Flag.Bool("allowOthers", true, "allows other users to access the file system")
|
||||
mountOptions.umaskString = cmdMount.Flag.String("umask", "022", "octal umask, e.g., 022, 0111")
|
||||
mountOptions.nonempty = cmdMount.Flag.Bool("nonempty", false, "allows the mounting over a non-empty directory")
|
||||
mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file")
|
||||
mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file")
|
||||
mountOptions.outsideContainerClusterMode = cmdMount.Flag.Bool("outsideContainerClusterMode", false, "allows other users to access the file system")
|
||||
|
||||
@@ -138,9 +138,7 @@ func parseInfoFile(r io.Reader) ([]*Info, error) {
|
||||
}
|
||||
|
||||
func osSpecificMountOptions() []fuse.MountOption {
|
||||
return []fuse.MountOption{
|
||||
fuse.AllowNonEmptyMount(),
|
||||
}
|
||||
return []fuse.MountOption{}
|
||||
}
|
||||
|
||||
func checkMountPointAvailable(dir string) bool {
|
||||
|
||||
+44
-58
@@ -13,8 +13,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/jacobsa/daemonize"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filesys"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||
@@ -35,24 +33,38 @@ func runMount(cmd *Command, args []string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
return RunMount(
|
||||
*mountOptions.filer,
|
||||
*mountOptions.filerMountRootPath,
|
||||
*mountOptions.dir,
|
||||
*mountOptions.collection,
|
||||
*mountOptions.replication,
|
||||
*mountOptions.dataCenter,
|
||||
*mountOptions.chunkSizeLimitMB,
|
||||
*mountOptions.allowOthers,
|
||||
*mountOptions.ttlSec,
|
||||
*mountOptions.dirListCacheLimit,
|
||||
os.FileMode(umask),
|
||||
*mountOptions.outsideContainerClusterMode,
|
||||
)
|
||||
return RunMount(&mountOptions, os.FileMode(umask))
|
||||
}
|
||||
|
||||
func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCenter string, chunkSizeLimitMB int,
|
||||
allowOthers bool, ttlSec int, dirListCacheLimit int64, umask os.FileMode, outsideContainerClusterMode bool) bool {
|
||||
func RunMount(option *MountOptions, umask os.FileMode) bool {
|
||||
|
||||
filer := *option.filer
|
||||
// parse filer grpc address
|
||||
filerGrpcAddress, err := pb.ParseFilerGrpcAddress(filer)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("ParseFilerGrpcAddress: %v", err)
|
||||
return true
|
||||
}
|
||||
|
||||
// try to connect to filer, filerBucketsPath may be useful later
|
||||
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
|
||||
var cipher bool
|
||||
err = pb.WithGrpcFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||
resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("get filer grpc address %s configuration: %v", filerGrpcAddress, err)
|
||||
}
|
||||
cipher = resp.Cipher
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
glog.Infof("failed to talk to filer %s: %v", filerGrpcAddress, err)
|
||||
return true
|
||||
}
|
||||
|
||||
filerMountRootPath := *option.filerMountRootPath
|
||||
dir := *option.dir
|
||||
chunkSizeLimitMB := *mountOptions.chunkSizeLimitMB
|
||||
|
||||
util.LoadConfiguration("security", false)
|
||||
|
||||
@@ -94,7 +106,7 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCente
|
||||
// Ensure target mount point availability
|
||||
if isValid := checkMountPointAvailable(dir); !isValid {
|
||||
glog.Fatalf("Expected mount to still be active, target mount point: %s, please check!", dir)
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
mountName := path.Base(dir)
|
||||
@@ -114,69 +126,47 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCente
|
||||
fuse.MaxReadahead(1024 * 128),
|
||||
fuse.AsyncRead(),
|
||||
fuse.WritebackCache(),
|
||||
fuse.AllowNonEmptyMount(),
|
||||
}
|
||||
|
||||
options = append(options, osSpecificMountOptions()...)
|
||||
|
||||
if allowOthers {
|
||||
if *option.allowOthers {
|
||||
options = append(options, fuse.AllowOther())
|
||||
}
|
||||
if *option.nonempty {
|
||||
options = append(options, fuse.AllowNonEmptyMount())
|
||||
}
|
||||
|
||||
c, err := fuse.Mount(dir, options...)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("mount: %v", err)
|
||||
daemonize.SignalOutcome(err)
|
||||
return true
|
||||
}
|
||||
|
||||
defer fuse.Unmount(dir)
|
||||
|
||||
util.OnInterrupt(func() {
|
||||
fuse.Unmount(dir)
|
||||
c.Close()
|
||||
})
|
||||
|
||||
// parse filer grpc address
|
||||
filerGrpcAddress, err := pb.ParseFilerGrpcAddress(filer)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("ParseFilerGrpcAddress: %v", err)
|
||||
daemonize.SignalOutcome(err)
|
||||
return true
|
||||
}
|
||||
|
||||
// try to connect to filer, filerBucketsPath may be useful later
|
||||
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
|
||||
var cipher bool
|
||||
err = pb.WithGrpcFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||
resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("get filer %s configuration: %v", filerGrpcAddress, err)
|
||||
}
|
||||
cipher = resp.Cipher
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
glog.Fatal(err)
|
||||
return false
|
||||
}
|
||||
|
||||
// find mount point
|
||||
mountRoot := filerMountRootPath
|
||||
if mountRoot != "/" && strings.HasSuffix(mountRoot, "/") {
|
||||
mountRoot = mountRoot[0 : len(mountRoot)-1]
|
||||
}
|
||||
|
||||
daemonize.SignalOutcome(nil)
|
||||
|
||||
err = fs.Serve(c, filesys.NewSeaweedFileSystem(&filesys.Option{
|
||||
FilerGrpcAddress: filerGrpcAddress,
|
||||
GrpcDialOption: grpcDialOption,
|
||||
FilerMountRootPath: mountRoot,
|
||||
Collection: collection,
|
||||
Replication: replication,
|
||||
TtlSec: int32(ttlSec),
|
||||
Collection: *option.collection,
|
||||
Replication: *option.replication,
|
||||
TtlSec: int32(*option.ttlSec),
|
||||
ChunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024,
|
||||
DataCenter: dataCenter,
|
||||
DirListCacheLimit: dirListCacheLimit,
|
||||
ChunkCacheCountLimit: *option.chunkCacheCountLimit,
|
||||
DataCenter: *option.dataCenter,
|
||||
DirListCacheLimit: *option.dirListCacheLimit,
|
||||
EntryCacheTtl: 3 * time.Second,
|
||||
MountUid: uid,
|
||||
MountGid: gid,
|
||||
@@ -184,18 +174,14 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCente
|
||||
MountCtime: fileInfo.ModTime(),
|
||||
MountMtime: time.Now(),
|
||||
Umask: umask,
|
||||
OutsideContainerClusterMode: outsideContainerClusterMode,
|
||||
OutsideContainerClusterMode: *mountOptions.outsideContainerClusterMode,
|
||||
Cipher: cipher,
|
||||
}))
|
||||
if err != nil {
|
||||
fuse.Unmount(dir)
|
||||
}
|
||||
|
||||
// check if the mount process has an error to report
|
||||
<-c.Ready
|
||||
if err := c.MountError; err != nil {
|
||||
glog.V(0).Infof("mount process: %v", err)
|
||||
daemonize.SignalOutcome(err)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -385,14 +385,22 @@ sequencer_etcd_urls = "http://127.0.0.1:2379"
|
||||
# create this number of logical volumes if no more writable volumes
|
||||
# count_x means how many copies of data.
|
||||
# e.g.:
|
||||
# 000 has only one copy, count_1
|
||||
# 010 and 001 has two copies, count_2
|
||||
# 011 has only 3 copies, count_3
|
||||
# 000 has only one copy, copy_1
|
||||
# 010 and 001 has two copies, copy_2
|
||||
# 011 has only 3 copies, copy_3
|
||||
[master.volume_growth]
|
||||
count_1 = 7 # create 1 x 7 = 7 actual volumes
|
||||
count_2 = 6 # create 2 x 6 = 12 actual volumes
|
||||
count_3 = 3 # create 3 x 3 = 9 actual volumes
|
||||
count_other = 1 # create n x 1 = n actual volumes
|
||||
copy_1 = 7 # create 1 x 7 = 7 actual volumes
|
||||
copy_2 = 6 # create 2 x 6 = 12 actual volumes
|
||||
copy_3 = 3 # create 3 x 3 = 9 actual volumes
|
||||
copy_other = 1 # create n x 1 = n actual volumes
|
||||
|
||||
# configuration flags for replication
|
||||
[master.replication]
|
||||
# any replication counts should be considered minimums. If you specify 010 and
|
||||
# have 3 different racks, that's still considered writable. Writes will still
|
||||
# try to replicate to all available volumes. You should only use this option
|
||||
# if you are doing your own replication or periodic sync of volumes.
|
||||
treat_replication_as_minimums = false
|
||||
|
||||
`
|
||||
)
|
||||
@@ -53,7 +53,7 @@ var (
|
||||
serverWhiteListOption = cmdServer.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.")
|
||||
serverDisableHttp = cmdServer.Flag.Bool("disableHttp", false, "disable http requests, only gRPC operations are allowed.")
|
||||
volumeDataFolders = cmdServer.Flag.String("dir", os.TempDir(), "directories to store data files. dir[,dir]...")
|
||||
volumeMaxDataVolumeCounts = cmdServer.Flag.String("volume.max", "7", "maximum numbers of volumes, count[,count]...")
|
||||
volumeMaxDataVolumeCounts = cmdServer.Flag.String("volume.max", "7", "maximum numbers of volumes, count[,count]... If set to zero on non-windows OS, the limit will be auto configured.")
|
||||
pulseSeconds = cmdServer.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
||||
isStartingFiler = cmdServer.Flag.Bool("filer", false, "whether to start filer")
|
||||
isStartingS3 = cmdServer.Flag.Bool("s3", false, "whether to start S3 gateway")
|
||||
|
||||
@@ -84,7 +84,7 @@ var cmdVolume = &Command{
|
||||
|
||||
var (
|
||||
volumeFolders = cmdVolume.Flag.String("dir", os.TempDir(), "directories to store data files. dir[,dir]...")
|
||||
maxVolumeCounts = cmdVolume.Flag.String("max", "7", "maximum numbers of volumes, count[,count]...")
|
||||
maxVolumeCounts = cmdVolume.Flag.String("max", "7", "maximum numbers of volumes, count[,count]... If set to zero on non-windows OS, the limit will be auto configured.")
|
||||
volumeWhiteListOption = cmdVolume.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.")
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmdWatch.Run = runWatch // break init cycle
|
||||
}
|
||||
|
||||
var cmdWatch = &Command{
|
||||
UsageLine: "watch <wip> [-filer=localhost:8888] [-target=/]",
|
||||
Short: "see recent changes on a filer",
|
||||
Long: `See recent changes on a filer.
|
||||
|
||||
`,
|
||||
}
|
||||
|
||||
var (
|
||||
watchFiler = cmdWatch.Flag.String("filer", "localhost:8888", "filer hostname:port")
|
||||
watchTarget = cmdWatch.Flag.String("pathPrefix", "/", "path to a folder or file, or common prefix for the folders or files on filer")
|
||||
)
|
||||
|
||||
func runWatch(cmd *Command, args []string) bool {
|
||||
|
||||
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
|
||||
|
||||
watchErr := pb.WithFilerClient(*watchFiler, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
stream, err := client.ListenForEvents(context.Background(), &filer_pb.ListenForEventsRequest{
|
||||
ClientName: "watch",
|
||||
PathPrefix: *watchTarget,
|
||||
SinceNs: 0,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("listen: %v", err)
|
||||
}
|
||||
|
||||
for {
|
||||
resp, listenErr := stream.Recv()
|
||||
if listenErr == io.EOF {
|
||||
return nil
|
||||
}
|
||||
if listenErr != nil {
|
||||
return listenErr
|
||||
}
|
||||
fmt.Printf("events: %+v\n", resp.EventNotification)
|
||||
}
|
||||
|
||||
})
|
||||
if watchErr != nil {
|
||||
fmt.Printf("watch %s: %v\n", *watchFiler, watchErr)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func (store *AbstractSqlStore) UpdateEntry(ctx context.Context, entry *filer2.En
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *AbstractSqlStore) FindEntry(ctx context.Context, fullpath filer2.FullPath) (*filer2.Entry, error) {
|
||||
func (store *AbstractSqlStore) FindEntry(ctx context.Context, fullpath util.FullPath) (*filer2.Entry, error) {
|
||||
|
||||
dir, name := fullpath.DirAndName()
|
||||
row := store.getTxOrDB(ctx).QueryRowContext(ctx, store.SqlFind, util.HashStringToLong(dir), name, dir)
|
||||
@@ -118,7 +118,7 @@ func (store *AbstractSqlStore) FindEntry(ctx context.Context, fullpath filer2.Fu
|
||||
return entry, nil
|
||||
}
|
||||
|
||||
func (store *AbstractSqlStore) DeleteEntry(ctx context.Context, fullpath filer2.FullPath) error {
|
||||
func (store *AbstractSqlStore) DeleteEntry(ctx context.Context, fullpath util.FullPath) error {
|
||||
|
||||
dir, name := fullpath.DirAndName()
|
||||
|
||||
@@ -135,7 +135,7 @@ func (store *AbstractSqlStore) DeleteEntry(ctx context.Context, fullpath filer2.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *AbstractSqlStore) DeleteFolderChildren(ctx context.Context, fullpath filer2.FullPath) error {
|
||||
func (store *AbstractSqlStore) DeleteFolderChildren(ctx context.Context, fullpath util.FullPath) error {
|
||||
|
||||
res, err := store.getTxOrDB(ctx).ExecContext(ctx, store.SqlDeleteFolderChildren, util.HashStringToLong(string(fullpath)), fullpath)
|
||||
if err != nil {
|
||||
@@ -150,7 +150,7 @@ func (store *AbstractSqlStore) DeleteFolderChildren(ctx context.Context, fullpat
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, fullpath filer2.FullPath, startFileName string, inclusive bool, limit int) (entries []*filer2.Entry, err error) {
|
||||
func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool, limit int) (entries []*filer2.Entry, err error) {
|
||||
|
||||
sqlText := store.SqlListExclusive
|
||||
if inclusive {
|
||||
@@ -172,7 +172,7 @@ func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, fullpat
|
||||
}
|
||||
|
||||
entry := &filer2.Entry{
|
||||
FullPath: filer2.NewFullPath(string(fullpath), name),
|
||||
FullPath: util.NewFullPath(string(fullpath), name),
|
||||
}
|
||||
if err = entry.DecodeAttributesAndChunks(data); err != nil {
|
||||
glog.V(0).Infof("scan decode %s : %v", entry.FullPath, err)
|
||||
|
||||
@@ -75,7 +75,7 @@ func (store *CassandraStore) UpdateEntry(ctx context.Context, entry *filer2.Entr
|
||||
return store.InsertEntry(ctx, entry)
|
||||
}
|
||||
|
||||
func (store *CassandraStore) FindEntry(ctx context.Context, fullpath filer2.FullPath) (entry *filer2.Entry, err error) {
|
||||
func (store *CassandraStore) FindEntry(ctx context.Context, fullpath util.FullPath) (entry *filer2.Entry, err error) {
|
||||
|
||||
dir, name := fullpath.DirAndName()
|
||||
var data []byte
|
||||
@@ -102,7 +102,7 @@ func (store *CassandraStore) FindEntry(ctx context.Context, fullpath filer2.Full
|
||||
return entry, nil
|
||||
}
|
||||
|
||||
func (store *CassandraStore) DeleteEntry(ctx context.Context, fullpath filer2.FullPath) error {
|
||||
func (store *CassandraStore) DeleteEntry(ctx context.Context, fullpath util.FullPath) error {
|
||||
|
||||
dir, name := fullpath.DirAndName()
|
||||
|
||||
@@ -115,7 +115,7 @@ func (store *CassandraStore) DeleteEntry(ctx context.Context, fullpath filer2.Fu
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *CassandraStore) DeleteFolderChildren(ctx context.Context, fullpath filer2.FullPath) error {
|
||||
func (store *CassandraStore) DeleteFolderChildren(ctx context.Context, fullpath util.FullPath) error {
|
||||
|
||||
if err := store.session.Query(
|
||||
"DELETE FROM filemeta WHERE directory=?",
|
||||
@@ -126,7 +126,7 @@ func (store *CassandraStore) DeleteFolderChildren(ctx context.Context, fullpath
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *CassandraStore) ListDirectoryEntries(ctx context.Context, fullpath filer2.FullPath, startFileName string, inclusive bool,
|
||||
func (store *CassandraStore) ListDirectoryEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool,
|
||||
limit int) (entries []*filer2.Entry, err error) {
|
||||
|
||||
cqlStr := "SELECT NAME, meta FROM filemeta WHERE directory=? AND name>? ORDER BY NAME ASC LIMIT ?"
|
||||
@@ -139,7 +139,7 @@ func (store *CassandraStore) ListDirectoryEntries(ctx context.Context, fullpath
|
||||
iter := store.session.Query(cqlStr, string(fullpath), startFileName, limit).Iter()
|
||||
for iter.Scan(&name, &data) {
|
||||
entry := &filer2.Entry{
|
||||
FullPath: filer2.NewFullPath(string(fullpath), name),
|
||||
FullPath: util.NewFullPath(string(fullpath), name),
|
||||
}
|
||||
if decodeErr := entry.DecodeAttributesAndChunks(data); decodeErr != nil {
|
||||
err = decodeErr
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
type Attr struct {
|
||||
@@ -27,7 +28,7 @@ func (attr Attr) IsDirectory() bool {
|
||||
}
|
||||
|
||||
type Entry struct {
|
||||
FullPath
|
||||
util.FullPath
|
||||
|
||||
Attr
|
||||
Extended map[string][]byte
|
||||
|
||||
@@ -92,7 +92,7 @@ func (store *EtcdStore) UpdateEntry(ctx context.Context, entry *filer2.Entry) (e
|
||||
return store.InsertEntry(ctx, entry)
|
||||
}
|
||||
|
||||
func (store *EtcdStore) FindEntry(ctx context.Context, fullpath filer2.FullPath) (entry *filer2.Entry, err error) {
|
||||
func (store *EtcdStore) FindEntry(ctx context.Context, fullpath weed_util.FullPath) (entry *filer2.Entry, err error) {
|
||||
key := genKey(fullpath.DirAndName())
|
||||
|
||||
resp, err := store.client.Get(ctx, string(key))
|
||||
@@ -115,7 +115,7 @@ func (store *EtcdStore) FindEntry(ctx context.Context, fullpath filer2.FullPath)
|
||||
return entry, nil
|
||||
}
|
||||
|
||||
func (store *EtcdStore) DeleteEntry(ctx context.Context, fullpath filer2.FullPath) (err error) {
|
||||
func (store *EtcdStore) DeleteEntry(ctx context.Context, fullpath weed_util.FullPath) (err error) {
|
||||
key := genKey(fullpath.DirAndName())
|
||||
|
||||
if _, err := store.client.Delete(ctx, string(key)); err != nil {
|
||||
@@ -125,7 +125,7 @@ func (store *EtcdStore) DeleteEntry(ctx context.Context, fullpath filer2.FullPat
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *EtcdStore) DeleteFolderChildren(ctx context.Context, fullpath filer2.FullPath) (err error) {
|
||||
func (store *EtcdStore) DeleteFolderChildren(ctx context.Context, fullpath weed_util.FullPath) (err error) {
|
||||
directoryPrefix := genDirectoryKeyPrefix(fullpath, "")
|
||||
|
||||
if _, err := store.client.Delete(ctx, string(directoryPrefix), clientv3.WithPrefix()); err != nil {
|
||||
@@ -136,7 +136,7 @@ func (store *EtcdStore) DeleteFolderChildren(ctx context.Context, fullpath filer
|
||||
}
|
||||
|
||||
func (store *EtcdStore) ListDirectoryEntries(
|
||||
ctx context.Context, fullpath filer2.FullPath, startFileName string, inclusive bool, limit int,
|
||||
ctx context.Context, fullpath weed_util.FullPath, startFileName string, inclusive bool, limit int,
|
||||
) (entries []*filer2.Entry, err error) {
|
||||
directoryPrefix := genDirectoryKeyPrefix(fullpath, "")
|
||||
|
||||
@@ -159,7 +159,7 @@ func (store *EtcdStore) ListDirectoryEntries(
|
||||
break
|
||||
}
|
||||
entry := &filer2.Entry{
|
||||
FullPath: filer2.NewFullPath(string(fullpath), fileName),
|
||||
FullPath: weed_util.NewFullPath(string(fullpath), fileName),
|
||||
}
|
||||
if decodeErr := entry.DecodeAttributesAndChunks(kv.Value); decodeErr != nil {
|
||||
err = decodeErr
|
||||
@@ -179,7 +179,7 @@ func genKey(dirPath, fileName string) (key []byte) {
|
||||
return key
|
||||
}
|
||||
|
||||
func genDirectoryKeyPrefix(fullpath filer2.FullPath, startFileName string) (keyPrefix []byte) {
|
||||
func genDirectoryKeyPrefix(fullpath weed_util.FullPath, startFileName string) (keyPrefix []byte) {
|
||||
keyPrefix = []byte(string(fullpath))
|
||||
keyPrefix = append(keyPrefix, DIR_FILE_SEPARATOR)
|
||||
if len(startFileName) > 0 {
|
||||
|
||||
@@ -3,6 +3,7 @@ package filer2
|
||||
import (
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
"math"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
@@ -72,10 +73,10 @@ type ChunkView struct {
|
||||
LogicOffset int64
|
||||
IsFullChunk bool
|
||||
CipherKey []byte
|
||||
isGzipped bool
|
||||
IsGzipped bool
|
||||
}
|
||||
|
||||
func ViewFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int) (views []*ChunkView) {
|
||||
func ViewFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int64) (views []*ChunkView) {
|
||||
|
||||
visibles := NonOverlappingVisibleIntervals(chunks)
|
||||
|
||||
@@ -83,9 +84,15 @@ func ViewFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int) (views
|
||||
|
||||
}
|
||||
|
||||
func ViewFromVisibleIntervals(visibles []VisibleInterval, offset int64, size int) (views []*ChunkView) {
|
||||
func ViewFromVisibleIntervals(visibles []VisibleInterval, offset int64, size int64) (views []*ChunkView) {
|
||||
|
||||
stop := offset + int64(size)
|
||||
stop := offset + size
|
||||
if size == math.MaxInt64 {
|
||||
stop = math.MaxInt64
|
||||
}
|
||||
if stop < offset {
|
||||
stop = math.MaxInt64
|
||||
}
|
||||
|
||||
for _, chunk := range visibles {
|
||||
|
||||
@@ -98,7 +105,7 @@ func ViewFromVisibleIntervals(visibles []VisibleInterval, offset int64, size int
|
||||
LogicOffset: offset,
|
||||
IsFullChunk: isFullChunk,
|
||||
CipherKey: chunk.cipherKey,
|
||||
isGzipped: chunk.isGzipped,
|
||||
IsGzipped: chunk.isGzipped,
|
||||
})
|
||||
offset = min(chunk.stop, stop)
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ func TestChunksReading(t *testing.T) {
|
||||
testcases := []struct {
|
||||
Chunks []*filer_pb.FileChunk
|
||||
Offset int64
|
||||
Size int
|
||||
Size int64
|
||||
Expected []*ChunkView
|
||||
}{
|
||||
// case 0: normal
|
||||
|
||||
+12
-9
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -14,6 +13,7 @@ import (
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/queue"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
||||
)
|
||||
@@ -35,15 +35,17 @@ type Filer struct {
|
||||
DirQueuesPath string
|
||||
buckets *FilerBuckets
|
||||
Cipher bool
|
||||
metaLogBuffer *queue.LogBuffer
|
||||
}
|
||||
|
||||
func NewFiler(masters []string, grpcDialOption grpc.DialOption, filerGrpcPort uint32) *Filer {
|
||||
func NewFiler(masters []string, grpcDialOption grpc.DialOption, filerGrpcPort uint32, notifyFn func()) *Filer {
|
||||
f := &Filer{
|
||||
directoryCache: ccache.New(ccache.Configure().MaxSize(1000).ItemsToPrune(100)),
|
||||
MasterClient: wdclient.NewMasterClient(grpcDialOption, "filer", filerGrpcPort, masters),
|
||||
fileIdDeletionQueue: util.NewUnboundedQueue(),
|
||||
GrpcDialOption: grpcDialOption,
|
||||
}
|
||||
f.metaLogBuffer = queue.NewLogBuffer(time.Minute, f.logFlushFunc, notifyFn)
|
||||
|
||||
go f.loopProcessingDeletion()
|
||||
|
||||
@@ -91,7 +93,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool) erro
|
||||
var lastDirectoryEntry *Entry
|
||||
|
||||
for i := 1; i < len(dirParts); i++ {
|
||||
dirPath := "/" + filepath.ToSlash(filepath.Join(dirParts[:i]...))
|
||||
dirPath := "/" + util.Join(dirParts[:i]...)
|
||||
// fmt.Printf("%d directory: %+v\n", i, dirPath)
|
||||
|
||||
// first check local cache
|
||||
@@ -100,7 +102,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool) erro
|
||||
// not found, check the store directly
|
||||
if dirEntry == nil {
|
||||
glog.V(4).Infof("find uncached directory: %s", dirPath)
|
||||
dirEntry, _ = f.FindEntry(ctx, FullPath(dirPath))
|
||||
dirEntry, _ = f.FindEntry(ctx, util.FullPath(dirPath))
|
||||
} else {
|
||||
// glog.V(4).Infof("found cached directory: %s", dirPath)
|
||||
}
|
||||
@@ -112,7 +114,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool) erro
|
||||
now := time.Now()
|
||||
|
||||
dirEntry = &Entry{
|
||||
FullPath: FullPath(dirPath),
|
||||
FullPath: util.FullPath(dirPath),
|
||||
Attr: Attr{
|
||||
Mtime: now,
|
||||
Crtime: now,
|
||||
@@ -127,7 +129,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool) erro
|
||||
glog.V(2).Infof("create directory: %s %v", dirPath, dirEntry.Mode)
|
||||
mkdirErr := f.store.InsertEntry(ctx, dirEntry)
|
||||
if mkdirErr != nil {
|
||||
if _, err := f.FindEntry(ctx, FullPath(dirPath)); err == filer_pb.ErrNotFound {
|
||||
if _, err := f.FindEntry(ctx, util.FullPath(dirPath)); err == filer_pb.ErrNotFound {
|
||||
glog.V(3).Infof("mkdir %s: %v", dirPath, mkdirErr)
|
||||
return fmt.Errorf("mkdir %s: %v", dirPath, mkdirErr)
|
||||
}
|
||||
@@ -207,7 +209,7 @@ func (f *Filer) UpdateEntry(ctx context.Context, oldEntry, entry *Entry) (err er
|
||||
return f.store.UpdateEntry(ctx, entry)
|
||||
}
|
||||
|
||||
func (f *Filer) FindEntry(ctx context.Context, p FullPath) (entry *Entry, err error) {
|
||||
func (f *Filer) FindEntry(ctx context.Context, p util.FullPath) (entry *Entry, err error) {
|
||||
|
||||
now := time.Now()
|
||||
|
||||
@@ -234,7 +236,7 @@ func (f *Filer) FindEntry(ctx context.Context, p FullPath) (entry *Entry, err er
|
||||
|
||||
}
|
||||
|
||||
func (f *Filer) ListDirectoryEntries(ctx context.Context, p FullPath, startFileName string, inclusive bool, limit int) ([]*Entry, error) {
|
||||
func (f *Filer) ListDirectoryEntries(ctx context.Context, p util.FullPath, startFileName string, inclusive bool, limit int) ([]*Entry, error) {
|
||||
if strings.HasSuffix(string(p), "/") && len(p) > 1 {
|
||||
p = p[0 : len(p)-1]
|
||||
}
|
||||
@@ -251,7 +253,7 @@ func (f *Filer) ListDirectoryEntries(ctx context.Context, p FullPath, startFileN
|
||||
return entries, err
|
||||
}
|
||||
|
||||
func (f *Filer) doListDirectoryEntries(ctx context.Context, p FullPath, startFileName string, inclusive bool, limit int) (entries []*Entry, expiredCount int, lastFileName string, err error) {
|
||||
func (f *Filer) doListDirectoryEntries(ctx context.Context, p util.FullPath, startFileName string, inclusive bool, limit int) (entries []*Entry, expiredCount int, lastFileName string, err error) {
|
||||
listedEntries, listErr := f.store.ListDirectoryEntries(ctx, p, startFileName, inclusive, limit)
|
||||
if listErr != nil {
|
||||
return listedEntries, expiredCount, "", listErr
|
||||
@@ -310,5 +312,6 @@ func (f *Filer) cacheSetDirectory(dirpath string, dirEntry *Entry, level int) {
|
||||
}
|
||||
|
||||
func (f *Filer) Shutdown() {
|
||||
f.metaLogBuffer.Shutdown()
|
||||
f.store.Shutdown()
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
type BucketName string
|
||||
@@ -28,7 +29,7 @@ func (f *Filer) LoadBuckets(dirBucketsPath string) {
|
||||
|
||||
limit := math.MaxInt32
|
||||
|
||||
entries, err := f.ListDirectoryEntries(context.Background(), FullPath(dirBucketsPath), "", false, limit)
|
||||
entries, err := f.ListDirectoryEntries(context.Background(), util.FullPath(dirBucketsPath), "", false, limit)
|
||||
|
||||
if err != nil {
|
||||
glog.V(1).Infof("no buckets found: %v", err)
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
package filer2
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func VolumeId(fileId string) string {
|
||||
lastCommaIndex := strings.LastIndex(fileId, ",")
|
||||
if lastCommaIndex > 0 {
|
||||
return fileId[:lastCommaIndex]
|
||||
}
|
||||
return fileId
|
||||
}
|
||||
|
||||
type FilerClient interface {
|
||||
WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error
|
||||
AdjustedUrl(hostAndPort string) string
|
||||
}
|
||||
|
||||
func ReadIntoBuffer(filerClient FilerClient, fullFilePath FullPath, buff []byte, chunkViews []*ChunkView, baseOffset int64) (totalRead int64, err error) {
|
||||
var vids []string
|
||||
for _, chunkView := range chunkViews {
|
||||
vids = append(vids, VolumeId(chunkView.FileId))
|
||||
}
|
||||
|
||||
vid2Locations := make(map[string]*filer_pb.Locations)
|
||||
|
||||
err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
glog.V(4).Infof("read fh lookup volume id locations: %v", vids)
|
||||
resp, err := client.LookupVolume(context.Background(), &filer_pb.LookupVolumeRequest{
|
||||
VolumeIds: vids,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
vid2Locations = resp.LocationsMap
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to lookup volume ids %v: %v", vids, err)
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
for _, chunkView := range chunkViews {
|
||||
wg.Add(1)
|
||||
go func(chunkView *ChunkView) {
|
||||
defer wg.Done()
|
||||
|
||||
glog.V(4).Infof("read fh reading chunk: %+v", chunkView)
|
||||
|
||||
locations := vid2Locations[VolumeId(chunkView.FileId)]
|
||||
if locations == nil || len(locations.Locations) == 0 {
|
||||
glog.V(0).Infof("failed to locate %s", chunkView.FileId)
|
||||
err = fmt.Errorf("failed to locate %s", chunkView.FileId)
|
||||
return
|
||||
}
|
||||
|
||||
volumeServerAddress := filerClient.AdjustedUrl(locations.Locations[0].Url)
|
||||
var n int64
|
||||
n, err = util.ReadUrl(fmt.Sprintf("http://%s/%s", volumeServerAddress, chunkView.FileId), chunkView.CipherKey, chunkView.isGzipped, chunkView.IsFullChunk, chunkView.Offset, int(chunkView.Size), buff[chunkView.LogicOffset-baseOffset:chunkView.LogicOffset-baseOffset+int64(chunkView.Size)])
|
||||
|
||||
if err != nil {
|
||||
|
||||
glog.V(0).Infof("%v read http://%s/%v %v bytes: %v", fullFilePath, volumeServerAddress, chunkView.FileId, n, err)
|
||||
|
||||
err = fmt.Errorf("failed to read http://%s/%s: %v",
|
||||
volumeServerAddress, chunkView.FileId, err)
|
||||
return
|
||||
}
|
||||
|
||||
glog.V(4).Infof("read fh read %d bytes: %+v", n, chunkView)
|
||||
totalRead += n
|
||||
|
||||
}(chunkView)
|
||||
}
|
||||
wg.Wait()
|
||||
return
|
||||
}
|
||||
|
||||
func GetEntry(filerClient FilerClient, fullFilePath FullPath) (entry *filer_pb.Entry, err error) {
|
||||
|
||||
dir, name := fullFilePath.DirAndName()
|
||||
|
||||
err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.LookupDirectoryEntryRequest{
|
||||
Directory: dir,
|
||||
Name: name,
|
||||
}
|
||||
|
||||
// glog.V(3).Infof("read %s request: %v", fullFilePath, request)
|
||||
resp, err := filer_pb.LookupEntry(client, request)
|
||||
if err != nil {
|
||||
if err == filer_pb.ErrNotFound {
|
||||
return nil
|
||||
}
|
||||
glog.V(3).Infof("read %s %v: %v", fullFilePath, resp, err)
|
||||
return err
|
||||
}
|
||||
|
||||
if resp.Entry == nil {
|
||||
// glog.V(3).Infof("read %s entry: %v", fullFilePath, entry)
|
||||
return nil
|
||||
}
|
||||
|
||||
entry = resp.Entry
|
||||
return nil
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ReadDirAllEntries(filerClient FilerClient, fullDirPath FullPath, prefix string, fn func(entry *filer_pb.Entry, isLast bool)) (err error) {
|
||||
|
||||
err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
lastEntryName := ""
|
||||
|
||||
request := &filer_pb.ListEntriesRequest{
|
||||
Directory: string(fullDirPath),
|
||||
Prefix: prefix,
|
||||
StartFromFileName: lastEntryName,
|
||||
Limit: math.MaxUint32,
|
||||
}
|
||||
|
||||
glog.V(3).Infof("read directory: %v", request)
|
||||
stream, err := client.ListEntries(context.Background(), request)
|
||||
if err != nil {
|
||||
return fmt.Errorf("list %s: %v", fullDirPath, err)
|
||||
}
|
||||
|
||||
var prevEntry *filer_pb.Entry
|
||||
for {
|
||||
resp, recvErr := stream.Recv()
|
||||
if recvErr != nil {
|
||||
if recvErr == io.EOF {
|
||||
if prevEntry != nil {
|
||||
fn(prevEntry, true)
|
||||
}
|
||||
break
|
||||
} else {
|
||||
return recvErr
|
||||
}
|
||||
}
|
||||
if prevEntry != nil {
|
||||
fn(prevEntry, false)
|
||||
}
|
||||
prevEntry = resp.Entry
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
@@ -7,9 +7,10 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p FullPath, isRecursive bool, ignoreRecursiveError, shouldDeleteChunks bool) (err error) {
|
||||
func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p util.FullPath, isRecursive bool, ignoreRecursiveError, shouldDeleteChunks bool) (err error) {
|
||||
if p == "/" {
|
||||
return nil
|
||||
}
|
||||
@@ -72,6 +73,8 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry
|
||||
var dirChunks []*filer_pb.FileChunk
|
||||
if sub.IsDirectory() {
|
||||
dirChunks, err = f.doBatchDeleteFolderMetaAndData(ctx, sub, isRecursive, ignoreRecursiveError, shouldDeleteChunks)
|
||||
f.cacheDelDirectory(string(sub.FullPath))
|
||||
f.NotifyUpdateEvent(sub, nil, shouldDeleteChunks)
|
||||
chunks = append(chunks, dirChunks...)
|
||||
} else {
|
||||
chunks = append(chunks, sub.Chunks...)
|
||||
@@ -86,14 +89,11 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry
|
||||
}
|
||||
}
|
||||
|
||||
f.cacheDelDirectory(string(entry.FullPath))
|
||||
|
||||
glog.V(3).Infof("deleting directory %v delete %d chunks: %v", entry.FullPath, len(chunks), shouldDeleteChunks)
|
||||
|
||||
if storeDeletionErr := f.store.DeleteFolderChildren(ctx, entry.FullPath); storeDeletionErr != nil {
|
||||
return nil, fmt.Errorf("filer store delete: %v", storeDeletionErr)
|
||||
}
|
||||
f.NotifyUpdateEvent(entry, nil, shouldDeleteChunks)
|
||||
|
||||
return chunks, nil
|
||||
}
|
||||
@@ -105,6 +105,9 @@ func (f *Filer) doDeleteEntryMetaAndData(ctx context.Context, entry *Entry, shou
|
||||
if storeDeletionErr := f.store.DeleteEntry(ctx, entry.FullPath); storeDeletionErr != nil {
|
||||
return fmt.Errorf("filer store delete: %v", storeDeletionErr)
|
||||
}
|
||||
if entry.IsDirectory() {
|
||||
f.cacheDelDirectory(string(entry.FullPath))
|
||||
}
|
||||
f.NotifyUpdateEvent(entry, nil, shouldDeleteChunks)
|
||||
|
||||
return nil
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/operation"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
||||
)
|
||||
|
||||
func (f *Filer) loopProcessingDeletion() {
|
||||
|
||||
lookupFunc := func(vids []string) (map[string]operation.LookupResult, error) {
|
||||
func LookupByMasterClientFn(masterClient *wdclient.MasterClient) func(vids []string) (map[string]operation.LookupResult, error) {
|
||||
return func(vids []string) (map[string]operation.LookupResult, error) {
|
||||
m := make(map[string]operation.LookupResult)
|
||||
for _, vid := range vids {
|
||||
locs, _ := f.MasterClient.GetVidLocations(vid)
|
||||
locs, _ := masterClient.GetVidLocations(vid)
|
||||
var locations []operation.Location
|
||||
for _, loc := range locs {
|
||||
locations = append(locations, operation.Location{
|
||||
@@ -28,18 +28,26 @@ func (f *Filer) loopProcessingDeletion() {
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Filer) loopProcessingDeletion() {
|
||||
|
||||
lookupFunc := LookupByMasterClientFn(f.MasterClient)
|
||||
|
||||
var deletionCount int
|
||||
for {
|
||||
deletionCount = 0
|
||||
f.fileIdDeletionQueue.Consume(func(fileIds []string) {
|
||||
deletionCount = len(fileIds)
|
||||
_, err := operation.DeleteFilesWithLookupVolumeId(f.GrpcDialOption, fileIds, lookupFunc)
|
||||
deleteResults, err := operation.DeleteFilesWithLookupVolumeId(f.GrpcDialOption, fileIds, lookupFunc)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("deleting fileIds len=%d error: %v", deletionCount, err)
|
||||
} else {
|
||||
glog.V(1).Infof("deleting fileIds len=%d", deletionCount)
|
||||
}
|
||||
if len(deleteResults) != deletionCount {
|
||||
glog.V(0).Infof("delete %d fileIds actual %d", deletionCount, len(deleteResults))
|
||||
}
|
||||
})
|
||||
|
||||
if deletionCount == 0 {
|
||||
|
||||
+99
-17
@@ -1,39 +1,121 @@
|
||||
package filer2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/notification"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func (f *Filer) NotifyUpdateEvent(oldEntry, newEntry *Entry, deleteChunks bool) {
|
||||
var key string
|
||||
var fullpath string
|
||||
if oldEntry != nil {
|
||||
key = string(oldEntry.FullPath)
|
||||
fullpath = string(oldEntry.FullPath)
|
||||
} else if newEntry != nil {
|
||||
key = string(newEntry.FullPath)
|
||||
fullpath = string(newEntry.FullPath)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
// println("fullpath:", fullpath)
|
||||
|
||||
if strings.HasPrefix(fullpath, "/.meta") {
|
||||
return
|
||||
}
|
||||
|
||||
newParentPath := ""
|
||||
if newEntry != nil {
|
||||
newParentPath, _ = newEntry.FullPath.DirAndName()
|
||||
}
|
||||
eventNotification := &filer_pb.EventNotification{
|
||||
OldEntry: oldEntry.ToProtoEntry(),
|
||||
NewEntry: newEntry.ToProtoEntry(),
|
||||
DeleteChunks: deleteChunks,
|
||||
NewParentPath: newParentPath,
|
||||
}
|
||||
|
||||
if notification.Queue != nil {
|
||||
glog.V(3).Infof("notifying entry update %v", fullpath)
|
||||
notification.Queue.SendMessage(fullpath, eventNotification)
|
||||
}
|
||||
|
||||
glog.V(3).Infof("notifying entry update %v", key)
|
||||
f.logMetaEvent(time.Now(), fullpath, eventNotification)
|
||||
|
||||
newParentPath := ""
|
||||
if newEntry != nil {
|
||||
newParentPath, _ = newEntry.FullPath.DirAndName()
|
||||
}
|
||||
}
|
||||
|
||||
notification.Queue.SendMessage(
|
||||
key,
|
||||
&filer_pb.EventNotification{
|
||||
OldEntry: oldEntry.ToProtoEntry(),
|
||||
NewEntry: newEntry.ToProtoEntry(),
|
||||
DeleteChunks: deleteChunks,
|
||||
NewParentPath: newParentPath,
|
||||
},
|
||||
)
|
||||
func (f *Filer) logMetaEvent(ts time.Time, fullpath string, eventNotification *filer_pb.EventNotification) {
|
||||
|
||||
dir, _ := util.FullPath(fullpath).DirAndName()
|
||||
|
||||
event := &filer_pb.FullEventNotification{
|
||||
Directory: dir,
|
||||
EventNotification: eventNotification,
|
||||
}
|
||||
data, err := proto.Marshal(event)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to marshal filer_pb.FullEventNotification %+v: %v", event, err)
|
||||
return
|
||||
}
|
||||
|
||||
f.metaLogBuffer.AddToBuffer(ts, []byte(dir), data)
|
||||
|
||||
}
|
||||
|
||||
func (f *Filer) logFlushFunc(startTime, stopTime time.Time, buf []byte) {
|
||||
targetFile := fmt.Sprintf("/.meta/log/%04d/%02d/%02d/%02d/%02d/%02d.%09d.log",
|
||||
startTime.Year(), startTime.Month(), startTime.Day(), startTime.Hour(), startTime.Minute(),
|
||||
startTime.Second(), startTime.Nanosecond())
|
||||
|
||||
if err := f.appendToFile(targetFile, buf); err != nil {
|
||||
glog.V(0).Infof("log write failed %s: %v", targetFile, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Filer) ReadLogBuffer(lastReadTime time.Time, eachEventFn func(fullpath string, eventNotification *filer_pb.EventNotification) error) (newLastReadTime time.Time, err error) {
|
||||
|
||||
var buf []byte
|
||||
newLastReadTime, buf = f.metaLogBuffer.ReadFromBuffer(lastReadTime)
|
||||
var processedTs int64
|
||||
|
||||
for pos := 0; pos+4 < len(buf); {
|
||||
|
||||
size := util.BytesToUint32(buf[pos : pos+4])
|
||||
entryData := buf[pos+4 : pos+4+int(size)]
|
||||
|
||||
logEntry := &filer_pb.LogEntry{}
|
||||
err = proto.Unmarshal(entryData, logEntry)
|
||||
if err != nil {
|
||||
glog.Errorf("unexpected unmarshal filer_pb.LogEntry: %v", err)
|
||||
return lastReadTime, fmt.Errorf("unexpected unmarshal filer_pb.LogEntry: %v", err)
|
||||
}
|
||||
|
||||
event := &filer_pb.FullEventNotification{}
|
||||
err = proto.Unmarshal(logEntry.Data, event)
|
||||
if err != nil {
|
||||
glog.Errorf("unexpected unmarshal filer_pb.FullEventNotification: %v", err)
|
||||
return lastReadTime, fmt.Errorf("unexpected unmarshal filer_pb.FullEventNotification: %v", err)
|
||||
}
|
||||
|
||||
err = eachEventFn(event.Directory, event.EventNotification)
|
||||
|
||||
processedTs = logEntry.TsNs
|
||||
|
||||
if err != nil {
|
||||
newLastReadTime = time.Unix(0, processedTs)
|
||||
return
|
||||
}
|
||||
|
||||
pos += 4 + int(size)
|
||||
|
||||
}
|
||||
|
||||
newLastReadTime = time.Unix(0, processedTs)
|
||||
return
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package filer2
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/operation"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func (f *Filer) appendToFile(targetFile string, data []byte) error {
|
||||
|
||||
// assign a volume location
|
||||
assignRequest := &operation.VolumeAssignRequest{
|
||||
Count: 1,
|
||||
}
|
||||
assignResult, err := operation.Assign(f.GetMaster(), f.GrpcDialOption, assignRequest)
|
||||
if err != nil {
|
||||
return fmt.Errorf("AssignVolume: %v", err)
|
||||
}
|
||||
if assignResult.Error != "" {
|
||||
return fmt.Errorf("AssignVolume error: %v", assignResult.Error)
|
||||
}
|
||||
|
||||
// upload data
|
||||
targetUrl := "http://" + assignResult.Url + "/" + assignResult.Fid
|
||||
uploadResult, err := operation.UploadData(targetUrl, "", false, data, false, "", nil, assignResult.Auth)
|
||||
if err != nil {
|
||||
return fmt.Errorf("upload data %s: %v", targetUrl, err)
|
||||
}
|
||||
// println("uploaded to", targetUrl)
|
||||
|
||||
// find out existing entry
|
||||
fullpath := util.FullPath(targetFile)
|
||||
entry, err := f.FindEntry(context.Background(), fullpath)
|
||||
var offset int64 = 0
|
||||
if err == filer_pb.ErrNotFound {
|
||||
entry = &Entry{
|
||||
FullPath: fullpath,
|
||||
Attr: Attr{
|
||||
Crtime: time.Now(),
|
||||
Mtime: time.Now(),
|
||||
Mode: os.FileMode(0644),
|
||||
Uid: OS_UID,
|
||||
Gid: OS_GID,
|
||||
},
|
||||
}
|
||||
} else {
|
||||
offset = int64(TotalSize(entry.Chunks))
|
||||
}
|
||||
|
||||
// append to existing chunks
|
||||
chunk := &filer_pb.FileChunk{
|
||||
FileId: assignResult.Fid,
|
||||
Offset: offset,
|
||||
Size: uint64(uploadResult.Size),
|
||||
Mtime: time.Now().UnixNano(),
|
||||
ETag: uploadResult.ETag,
|
||||
IsGzipped: uploadResult.Gzip > 0,
|
||||
}
|
||||
entry.Chunks = append(entry.Chunks, chunk)
|
||||
|
||||
// update the entry
|
||||
err = f.CreateEntry(context.Background(), entry, false)
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestProtoMarshalText(t *testing.T) {
|
||||
|
||||
oldEntry := &Entry{
|
||||
FullPath: FullPath("/this/path/to"),
|
||||
FullPath: util.FullPath("/this/path/to"),
|
||||
Attr: Attr{
|
||||
Mtime: time.Now(),
|
||||
Mode: 0644,
|
||||
|
||||
@@ -17,10 +17,10 @@ type FilerStore interface {
|
||||
InsertEntry(context.Context, *Entry) error
|
||||
UpdateEntry(context.Context, *Entry) (err error)
|
||||
// err == filer2.ErrNotFound if not found
|
||||
FindEntry(context.Context, FullPath) (entry *Entry, err error)
|
||||
DeleteEntry(context.Context, FullPath) (err error)
|
||||
DeleteFolderChildren(context.Context, FullPath) (err error)
|
||||
ListDirectoryEntries(ctx context.Context, dirPath FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error)
|
||||
FindEntry(context.Context, util.FullPath) (entry *Entry, err error)
|
||||
DeleteEntry(context.Context, util.FullPath) (err error)
|
||||
DeleteFolderChildren(context.Context, util.FullPath) (err error)
|
||||
ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error)
|
||||
|
||||
BeginTransaction(ctx context.Context) (context.Context, error)
|
||||
CommitTransaction(ctx context.Context) error
|
||||
@@ -72,7 +72,7 @@ func (fsw *FilerStoreWrapper) UpdateEntry(ctx context.Context, entry *Entry) err
|
||||
return fsw.actualStore.UpdateEntry(ctx, entry)
|
||||
}
|
||||
|
||||
func (fsw *FilerStoreWrapper) FindEntry(ctx context.Context, fp FullPath) (entry *Entry, err error) {
|
||||
func (fsw *FilerStoreWrapper) FindEntry(ctx context.Context, fp util.FullPath) (entry *Entry, err error) {
|
||||
stats.FilerStoreCounter.WithLabelValues(fsw.actualStore.GetName(), "find").Inc()
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
@@ -87,7 +87,7 @@ func (fsw *FilerStoreWrapper) FindEntry(ctx context.Context, fp FullPath) (entry
|
||||
return
|
||||
}
|
||||
|
||||
func (fsw *FilerStoreWrapper) DeleteEntry(ctx context.Context, fp FullPath) (err error) {
|
||||
func (fsw *FilerStoreWrapper) DeleteEntry(ctx context.Context, fp util.FullPath) (err error) {
|
||||
stats.FilerStoreCounter.WithLabelValues(fsw.actualStore.GetName(), "delete").Inc()
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
@@ -97,7 +97,7 @@ func (fsw *FilerStoreWrapper) DeleteEntry(ctx context.Context, fp FullPath) (err
|
||||
return fsw.actualStore.DeleteEntry(ctx, fp)
|
||||
}
|
||||
|
||||
func (fsw *FilerStoreWrapper) DeleteFolderChildren(ctx context.Context, fp FullPath) (err error) {
|
||||
func (fsw *FilerStoreWrapper) DeleteFolderChildren(ctx context.Context, fp util.FullPath) (err error) {
|
||||
stats.FilerStoreCounter.WithLabelValues(fsw.actualStore.GetName(), "deleteFolderChildren").Inc()
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
@@ -107,7 +107,7 @@ func (fsw *FilerStoreWrapper) DeleteFolderChildren(ctx context.Context, fp FullP
|
||||
return fsw.actualStore.DeleteFolderChildren(ctx, fp)
|
||||
}
|
||||
|
||||
func (fsw *FilerStoreWrapper) ListDirectoryEntries(ctx context.Context, dirPath FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error) {
|
||||
func (fsw *FilerStoreWrapper) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error) {
|
||||
stats.FilerStoreCounter.WithLabelValues(fsw.actualStore.GetName(), "list").Inc()
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
|
||||
@@ -89,7 +89,7 @@ func (store *LevelDBStore) UpdateEntry(ctx context.Context, entry *filer2.Entry)
|
||||
return store.InsertEntry(ctx, entry)
|
||||
}
|
||||
|
||||
func (store *LevelDBStore) FindEntry(ctx context.Context, fullpath filer2.FullPath) (entry *filer2.Entry, err error) {
|
||||
func (store *LevelDBStore) FindEntry(ctx context.Context, fullpath weed_util.FullPath) (entry *filer2.Entry, err error) {
|
||||
key := genKey(fullpath.DirAndName())
|
||||
|
||||
data, err := store.db.Get(key, nil)
|
||||
@@ -114,7 +114,7 @@ func (store *LevelDBStore) FindEntry(ctx context.Context, fullpath filer2.FullPa
|
||||
return entry, nil
|
||||
}
|
||||
|
||||
func (store *LevelDBStore) DeleteEntry(ctx context.Context, fullpath filer2.FullPath) (err error) {
|
||||
func (store *LevelDBStore) DeleteEntry(ctx context.Context, fullpath weed_util.FullPath) (err error) {
|
||||
key := genKey(fullpath.DirAndName())
|
||||
|
||||
err = store.db.Delete(key, nil)
|
||||
@@ -125,7 +125,7 @@ func (store *LevelDBStore) DeleteEntry(ctx context.Context, fullpath filer2.Full
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *LevelDBStore) DeleteFolderChildren(ctx context.Context, fullpath filer2.FullPath) (err error) {
|
||||
func (store *LevelDBStore) DeleteFolderChildren(ctx context.Context, fullpath weed_util.FullPath) (err error) {
|
||||
|
||||
batch := new(leveldb.Batch)
|
||||
|
||||
@@ -153,7 +153,7 @@ func (store *LevelDBStore) DeleteFolderChildren(ctx context.Context, fullpath fi
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *LevelDBStore) ListDirectoryEntries(ctx context.Context, fullpath filer2.FullPath, startFileName string, inclusive bool,
|
||||
func (store *LevelDBStore) ListDirectoryEntries(ctx context.Context, fullpath weed_util.FullPath, startFileName string, inclusive bool,
|
||||
limit int) (entries []*filer2.Entry, err error) {
|
||||
|
||||
directoryPrefix := genDirectoryKeyPrefix(fullpath, "")
|
||||
@@ -176,7 +176,7 @@ func (store *LevelDBStore) ListDirectoryEntries(ctx context.Context, fullpath fi
|
||||
break
|
||||
}
|
||||
entry := &filer2.Entry{
|
||||
FullPath: filer2.NewFullPath(string(fullpath), fileName),
|
||||
FullPath: weed_util.NewFullPath(string(fullpath), fileName),
|
||||
}
|
||||
if decodeErr := entry.DecodeAttributesAndChunks(iter.Value()); decodeErr != nil {
|
||||
err = decodeErr
|
||||
@@ -197,7 +197,7 @@ func genKey(dirPath, fileName string) (key []byte) {
|
||||
return key
|
||||
}
|
||||
|
||||
func genDirectoryKeyPrefix(fullpath filer2.FullPath, startFileName string) (keyPrefix []byte) {
|
||||
func genDirectoryKeyPrefix(fullpath weed_util.FullPath, startFileName string) (keyPrefix []byte) {
|
||||
keyPrefix = []byte(string(fullpath))
|
||||
keyPrefix = append(keyPrefix, DIR_FILE_SEPARATOR)
|
||||
if len(startFileName) > 0 {
|
||||
|
||||
@@ -2,14 +2,16 @@ package leveldb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func TestCreateAndFind(t *testing.T) {
|
||||
filer := filer2.NewFiler(nil, nil, 0)
|
||||
filer := filer2.NewFiler(nil, nil, 0, nil)
|
||||
dir, _ := ioutil.TempDir("", "seaweedfs_filer_test")
|
||||
defer os.RemoveAll(dir)
|
||||
store := &LevelDBStore{}
|
||||
@@ -17,7 +19,7 @@ func TestCreateAndFind(t *testing.T) {
|
||||
filer.SetStore(store)
|
||||
filer.DisableDirectoryCache()
|
||||
|
||||
fullpath := filer2.FullPath("/home/chris/this/is/one/file1.jpg")
|
||||
fullpath := util.FullPath("/home/chris/this/is/one/file1.jpg")
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -48,14 +50,14 @@ func TestCreateAndFind(t *testing.T) {
|
||||
}
|
||||
|
||||
// checking one upper directory
|
||||
entries, _ := filer.ListDirectoryEntries(ctx, filer2.FullPath("/home/chris/this/is/one"), "", false, 100)
|
||||
entries, _ := filer.ListDirectoryEntries(ctx, util.FullPath("/home/chris/this/is/one"), "", false, 100)
|
||||
if len(entries) != 1 {
|
||||
t.Errorf("list entries count: %v", len(entries))
|
||||
return
|
||||
}
|
||||
|
||||
// checking one upper directory
|
||||
entries, _ = filer.ListDirectoryEntries(ctx, filer2.FullPath("/"), "", false, 100)
|
||||
entries, _ = filer.ListDirectoryEntries(ctx, util.FullPath("/"), "", false, 100)
|
||||
if len(entries) != 1 {
|
||||
t.Errorf("list entries count: %v", len(entries))
|
||||
return
|
||||
@@ -64,7 +66,7 @@ func TestCreateAndFind(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEmptyRoot(t *testing.T) {
|
||||
filer := filer2.NewFiler(nil, nil, 0)
|
||||
filer := filer2.NewFiler(nil, nil, 0, nil)
|
||||
dir, _ := ioutil.TempDir("", "seaweedfs_filer_test2")
|
||||
defer os.RemoveAll(dir)
|
||||
store := &LevelDBStore{}
|
||||
@@ -75,7 +77,7 @@ func TestEmptyRoot(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
// checking one upper directory
|
||||
entries, err := filer.ListDirectoryEntries(ctx, filer2.FullPath("/"), "", false, 100)
|
||||
entries, err := filer.ListDirectoryEntries(ctx, util.FullPath("/"), "", false, 100)
|
||||
if err != nil {
|
||||
t.Errorf("list entries: %v", err)
|
||||
return
|
||||
|
||||
@@ -98,7 +98,7 @@ func (store *LevelDB2Store) UpdateEntry(ctx context.Context, entry *filer2.Entry
|
||||
return store.InsertEntry(ctx, entry)
|
||||
}
|
||||
|
||||
func (store *LevelDB2Store) FindEntry(ctx context.Context, fullpath filer2.FullPath) (entry *filer2.Entry, err error) {
|
||||
func (store *LevelDB2Store) FindEntry(ctx context.Context, fullpath weed_util.FullPath) (entry *filer2.Entry, err error) {
|
||||
dir, name := fullpath.DirAndName()
|
||||
key, partitionId := genKey(dir, name, store.dbCount)
|
||||
|
||||
@@ -124,7 +124,7 @@ func (store *LevelDB2Store) FindEntry(ctx context.Context, fullpath filer2.FullP
|
||||
return entry, nil
|
||||
}
|
||||
|
||||
func (store *LevelDB2Store) DeleteEntry(ctx context.Context, fullpath filer2.FullPath) (err error) {
|
||||
func (store *LevelDB2Store) DeleteEntry(ctx context.Context, fullpath weed_util.FullPath) (err error) {
|
||||
dir, name := fullpath.DirAndName()
|
||||
key, partitionId := genKey(dir, name, store.dbCount)
|
||||
|
||||
@@ -136,7 +136,7 @@ func (store *LevelDB2Store) DeleteEntry(ctx context.Context, fullpath filer2.Ful
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *LevelDB2Store) DeleteFolderChildren(ctx context.Context, fullpath filer2.FullPath) (err error) {
|
||||
func (store *LevelDB2Store) DeleteFolderChildren(ctx context.Context, fullpath weed_util.FullPath) (err error) {
|
||||
directoryPrefix, partitionId := genDirectoryKeyPrefix(fullpath, "", store.dbCount)
|
||||
|
||||
batch := new(leveldb.Batch)
|
||||
@@ -164,7 +164,7 @@ func (store *LevelDB2Store) DeleteFolderChildren(ctx context.Context, fullpath f
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *LevelDB2Store) ListDirectoryEntries(ctx context.Context, fullpath filer2.FullPath, startFileName string, inclusive bool,
|
||||
func (store *LevelDB2Store) ListDirectoryEntries(ctx context.Context, fullpath weed_util.FullPath, startFileName string, inclusive bool,
|
||||
limit int) (entries []*filer2.Entry, err error) {
|
||||
|
||||
directoryPrefix, partitionId := genDirectoryKeyPrefix(fullpath, "", store.dbCount)
|
||||
@@ -188,7 +188,7 @@ func (store *LevelDB2Store) ListDirectoryEntries(ctx context.Context, fullpath f
|
||||
break
|
||||
}
|
||||
entry := &filer2.Entry{
|
||||
FullPath: filer2.NewFullPath(string(fullpath), fileName),
|
||||
FullPath: weed_util.NewFullPath(string(fullpath), fileName),
|
||||
}
|
||||
|
||||
// println("list", entry.FullPath, "chunks", len(entry.Chunks))
|
||||
@@ -211,7 +211,7 @@ func genKey(dirPath, fileName string, dbCount int) (key []byte, partitionId int)
|
||||
return key, partitionId
|
||||
}
|
||||
|
||||
func genDirectoryKeyPrefix(fullpath filer2.FullPath, startFileName string, dbCount int) (keyPrefix []byte, partitionId int) {
|
||||
func genDirectoryKeyPrefix(fullpath weed_util.FullPath, startFileName string, dbCount int) (keyPrefix []byte, partitionId int) {
|
||||
keyPrefix, partitionId = hashToBytes(string(fullpath), dbCount)
|
||||
if len(startFileName) > 0 {
|
||||
keyPrefix = append(keyPrefix, []byte(startFileName)...)
|
||||
|
||||
@@ -2,14 +2,16 @@ package leveldb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func TestCreateAndFind(t *testing.T) {
|
||||
filer := filer2.NewFiler(nil, nil, 0)
|
||||
filer := filer2.NewFiler(nil, nil, 0, nil)
|
||||
dir, _ := ioutil.TempDir("", "seaweedfs_filer_test")
|
||||
defer os.RemoveAll(dir)
|
||||
store := &LevelDB2Store{}
|
||||
@@ -17,7 +19,7 @@ func TestCreateAndFind(t *testing.T) {
|
||||
filer.SetStore(store)
|
||||
filer.DisableDirectoryCache()
|
||||
|
||||
fullpath := filer2.FullPath("/home/chris/this/is/one/file1.jpg")
|
||||
fullpath := util.FullPath("/home/chris/this/is/one/file1.jpg")
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -48,14 +50,14 @@ func TestCreateAndFind(t *testing.T) {
|
||||
}
|
||||
|
||||
// checking one upper directory
|
||||
entries, _ := filer.ListDirectoryEntries(ctx, filer2.FullPath("/home/chris/this/is/one"), "", false, 100)
|
||||
entries, _ := filer.ListDirectoryEntries(ctx, util.FullPath("/home/chris/this/is/one"), "", false, 100)
|
||||
if len(entries) != 1 {
|
||||
t.Errorf("list entries count: %v", len(entries))
|
||||
return
|
||||
}
|
||||
|
||||
// checking one upper directory
|
||||
entries, _ = filer.ListDirectoryEntries(ctx, filer2.FullPath("/"), "", false, 100)
|
||||
entries, _ = filer.ListDirectoryEntries(ctx, util.FullPath("/"), "", false, 100)
|
||||
if len(entries) != 1 {
|
||||
t.Errorf("list entries count: %v", len(entries))
|
||||
return
|
||||
@@ -64,7 +66,7 @@ func TestCreateAndFind(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEmptyRoot(t *testing.T) {
|
||||
filer := filer2.NewFiler(nil, nil, 0)
|
||||
filer := filer2.NewFiler(nil, nil, 0, nil)
|
||||
dir, _ := ioutil.TempDir("", "seaweedfs_filer_test2")
|
||||
defer os.RemoveAll(dir)
|
||||
store := &LevelDB2Store{}
|
||||
@@ -75,7 +77,7 @@ func TestEmptyRoot(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
// checking one upper directory
|
||||
entries, err := filer.ListDirectoryEntries(ctx, filer2.FullPath("/"), "", false, 100)
|
||||
entries, err := filer.ListDirectoryEntries(ctx, util.FullPath("/"), "", false, 100)
|
||||
if err != nil {
|
||||
t.Errorf("list entries: %v", err)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
package filer2
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/pb_cache"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
||||
)
|
||||
|
||||
type ChunkReadAt struct {
|
||||
masterClient *wdclient.MasterClient
|
||||
chunkViews []*ChunkView
|
||||
buffer []byte
|
||||
bufferOffset int64
|
||||
lookupFileId func(fileId string) (targetUrl string, err error)
|
||||
readerLock sync.Mutex
|
||||
|
||||
chunkCache *pb_cache.ChunkCache
|
||||
}
|
||||
|
||||
// var _ = io.ReaderAt(&ChunkReadAt{})
|
||||
|
||||
func NewChunkReaderAtFromClient(filerClient filer_pb.FilerClient, chunkViews []*ChunkView, chunkCache *pb_cache.ChunkCache) *ChunkReadAt {
|
||||
|
||||
return &ChunkReadAt{
|
||||
chunkViews: chunkViews,
|
||||
lookupFileId: func(fileId string) (targetUrl string, err error) {
|
||||
err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
vid := VolumeId(fileId)
|
||||
resp, err := client.LookupVolume(context.Background(), &filer_pb.LookupVolumeRequest{
|
||||
VolumeIds: []string{vid},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
locations := resp.LocationsMap[vid]
|
||||
if locations == nil || len(locations.Locations) == 0 {
|
||||
glog.V(0).Infof("failed to locate %s", fileId)
|
||||
return fmt.Errorf("failed to locate %s", fileId)
|
||||
}
|
||||
|
||||
volumeServerAddress := filerClient.AdjustedUrl(locations.Locations[0].Url)
|
||||
|
||||
targetUrl = fmt.Sprintf("http://%s/%s", volumeServerAddress, fileId)
|
||||
|
||||
return nil
|
||||
})
|
||||
return
|
||||
},
|
||||
bufferOffset: -1,
|
||||
chunkCache: chunkCache,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ChunkReadAt) ReadAt(p []byte, offset int64) (n int, err error) {
|
||||
|
||||
c.readerLock.Lock()
|
||||
defer c.readerLock.Unlock()
|
||||
|
||||
for n < len(p) && err == nil {
|
||||
readCount, readErr := c.doReadAt(p[n:], offset+int64(n))
|
||||
n += readCount
|
||||
err = readErr
|
||||
if readCount == 0 {
|
||||
return n, nil
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) {
|
||||
|
||||
var found bool
|
||||
for _, chunk := range c.chunkViews {
|
||||
if chunk.LogicOffset <= offset && offset < chunk.LogicOffset+int64(chunk.Size) {
|
||||
found = true
|
||||
if c.bufferOffset != chunk.LogicOffset {
|
||||
c.buffer, err = c.fetchChunkData(chunk)
|
||||
c.bufferOffset = chunk.LogicOffset
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
n = copy(p, c.buffer[offset-c.bufferOffset:])
|
||||
|
||||
// fmt.Printf("> doReadAt [%d,%d), buffer:[%d,%d)\n", offset, offset+int64(n), c.bufferOffset, c.bufferOffset+int64(len(c.buffer)))
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
func (c *ChunkReadAt) fetchChunkData(chunkView *ChunkView) (data []byte, err error) {
|
||||
|
||||
// fmt.Printf("fetching %s [%d,%d)\n", chunkView.FileId, chunkView.LogicOffset, chunkView.LogicOffset+int64(chunkView.Size))
|
||||
|
||||
chunkData := c.chunkCache.GetChunk(chunkView.FileId)
|
||||
if chunkData != nil {
|
||||
glog.V(3).Infof("cache hit %s [%d,%d)", chunkView.FileId, chunkView.LogicOffset, chunkView.LogicOffset+int64(chunkView.Size))
|
||||
} else {
|
||||
chunkData, err = c.doFetchFullChunkData(chunkView.FileId, chunkView.CipherKey, chunkView.IsGzipped)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if int64(len(chunkData)) < chunkView.Offset+int64(chunkView.Size) {
|
||||
return nil, fmt.Errorf("unexpected larger chunkView [%d,%d) than chunk %d", chunkView.Offset, chunkView.Offset+int64(chunkView.Size), len(chunkData))
|
||||
}
|
||||
|
||||
data = chunkData[chunkView.Offset : chunkView.Offset+int64(chunkView.Size)]
|
||||
|
||||
c.chunkCache.SetChunk(chunkView.FileId, chunkData)
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func (c *ChunkReadAt) doFetchFullChunkData(fileId string, cipherKey []byte, isGzipped bool) ([]byte, error) {
|
||||
|
||||
urlString, err := c.lookupFileId(fileId)
|
||||
if err != nil {
|
||||
glog.V(1).Infof("operation LookupFileId %s failed, err: %v", fileId, err)
|
||||
return nil, err
|
||||
}
|
||||
var buffer bytes.Buffer
|
||||
err = util.ReadUrlAsStream(urlString, cipherKey, isGzipped, true, 0, 0, func(data []byte) {
|
||||
buffer.Write(data)
|
||||
})
|
||||
if err != nil {
|
||||
glog.V(1).Infof("read %s failed, err: %v", fileId, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return buffer.Bytes(), nil
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -61,7 +62,7 @@ func (store *UniversalRedisStore) UpdateEntry(ctx context.Context, entry *filer2
|
||||
return store.InsertEntry(ctx, entry)
|
||||
}
|
||||
|
||||
func (store *UniversalRedisStore) FindEntry(ctx context.Context, fullpath filer2.FullPath) (entry *filer2.Entry, err error) {
|
||||
func (store *UniversalRedisStore) FindEntry(ctx context.Context, fullpath util.FullPath) (entry *filer2.Entry, err error) {
|
||||
|
||||
data, err := store.Client.Get(string(fullpath)).Result()
|
||||
if err == redis.Nil {
|
||||
@@ -83,7 +84,7 @@ func (store *UniversalRedisStore) FindEntry(ctx context.Context, fullpath filer2
|
||||
return entry, nil
|
||||
}
|
||||
|
||||
func (store *UniversalRedisStore) DeleteEntry(ctx context.Context, fullpath filer2.FullPath) (err error) {
|
||||
func (store *UniversalRedisStore) DeleteEntry(ctx context.Context, fullpath util.FullPath) (err error) {
|
||||
|
||||
_, err = store.Client.Del(string(fullpath)).Result()
|
||||
|
||||
@@ -102,7 +103,7 @@ func (store *UniversalRedisStore) DeleteEntry(ctx context.Context, fullpath file
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *UniversalRedisStore) DeleteFolderChildren(ctx context.Context, fullpath filer2.FullPath) (err error) {
|
||||
func (store *UniversalRedisStore) DeleteFolderChildren(ctx context.Context, fullpath util.FullPath) (err error) {
|
||||
|
||||
members, err := store.Client.SMembers(genDirectoryListKey(string(fullpath))).Result()
|
||||
if err != nil {
|
||||
@@ -110,7 +111,7 @@ func (store *UniversalRedisStore) DeleteFolderChildren(ctx context.Context, full
|
||||
}
|
||||
|
||||
for _, fileName := range members {
|
||||
path := filer2.NewFullPath(string(fullpath), fileName)
|
||||
path := util.NewFullPath(string(fullpath), fileName)
|
||||
_, err = store.Client.Del(string(path)).Result()
|
||||
if err != nil {
|
||||
return fmt.Errorf("delete %s in parent dir: %v", fullpath, err)
|
||||
@@ -120,7 +121,7 @@ func (store *UniversalRedisStore) DeleteFolderChildren(ctx context.Context, full
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *UniversalRedisStore) ListDirectoryEntries(ctx context.Context, fullpath filer2.FullPath, startFileName string, inclusive bool,
|
||||
func (store *UniversalRedisStore) ListDirectoryEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool,
|
||||
limit int) (entries []*filer2.Entry, err error) {
|
||||
|
||||
dirListKey := genDirectoryListKey(string(fullpath))
|
||||
@@ -158,7 +159,7 @@ func (store *UniversalRedisStore) ListDirectoryEntries(ctx context.Context, full
|
||||
|
||||
// fetch entry meta
|
||||
for _, fileName := range members {
|
||||
path := filer2.NewFullPath(string(fullpath), fileName)
|
||||
path := util.NewFullPath(string(fullpath), fileName)
|
||||
entry, err := store.FindEntry(ctx, path)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("list %s : %v", path, err)
|
||||
|
||||
+113
-2
@@ -1,7 +1,10 @@
|
||||
package filer2
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
@@ -9,7 +12,7 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
||||
)
|
||||
|
||||
func StreamContent(masterClient *wdclient.MasterClient, w io.Writer, chunks []*filer_pb.FileChunk, offset int64, size int) error {
|
||||
func StreamContent(masterClient *wdclient.MasterClient, w io.Writer, chunks []*filer_pb.FileChunk, offset int64, size int64) error {
|
||||
|
||||
chunkViews := ViewFromChunks(chunks, offset, size)
|
||||
|
||||
@@ -28,7 +31,7 @@ func StreamContent(masterClient *wdclient.MasterClient, w io.Writer, chunks []*f
|
||||
for _, chunkView := range chunkViews {
|
||||
|
||||
urlString := fileId2Url[chunkView.FileId]
|
||||
err := util.ReadUrlAsStream(urlString, chunkView.CipherKey, chunkView.isGzipped, chunkView.IsFullChunk, chunkView.Offset, int(chunkView.Size), func(data []byte) {
|
||||
err := util.ReadUrlAsStream(urlString, chunkView.CipherKey, chunkView.IsGzipped, chunkView.IsFullChunk, chunkView.Offset, int(chunkView.Size), func(data []byte) {
|
||||
w.Write(data)
|
||||
})
|
||||
if err != nil {
|
||||
@@ -40,3 +43,111 @@ func StreamContent(masterClient *wdclient.MasterClient, w io.Writer, chunks []*f
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
type ChunkStreamReader struct {
|
||||
masterClient *wdclient.MasterClient
|
||||
chunkViews []*ChunkView
|
||||
logicOffset int64
|
||||
buffer []byte
|
||||
bufferOffset int64
|
||||
bufferPos int
|
||||
chunkIndex int
|
||||
lookupFileId func(fileId string) (targetUrl string, err error)
|
||||
}
|
||||
|
||||
var _ = io.ReadSeeker(&ChunkStreamReader{})
|
||||
|
||||
func NewChunkStreamReaderFromFiler(masterClient *wdclient.MasterClient, chunks []*filer_pb.FileChunk) *ChunkStreamReader {
|
||||
|
||||
chunkViews := ViewFromChunks(chunks, 0, math.MaxInt32)
|
||||
|
||||
return &ChunkStreamReader{
|
||||
chunkViews: chunkViews,
|
||||
lookupFileId: func(fileId string) (targetUrl string, err error) {
|
||||
return masterClient.LookupFileId(fileId)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ChunkStreamReader) Read(p []byte) (n int, err error) {
|
||||
if c.isBufferEmpty() {
|
||||
if c.chunkIndex >= len(c.chunkViews) {
|
||||
return 0, io.EOF
|
||||
}
|
||||
chunkView := c.chunkViews[c.chunkIndex]
|
||||
c.fetchChunkToBuffer(chunkView)
|
||||
c.chunkIndex++
|
||||
}
|
||||
n = copy(p, c.buffer[c.bufferPos:])
|
||||
c.bufferPos += n
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ChunkStreamReader) isBufferEmpty() bool {
|
||||
return len(c.buffer) <= c.bufferPos
|
||||
}
|
||||
|
||||
func (c *ChunkStreamReader) Seek(offset int64, whence int) (int64, error) {
|
||||
|
||||
var totalSize int64
|
||||
for _, chunk := range c.chunkViews {
|
||||
totalSize += int64(chunk.Size)
|
||||
}
|
||||
|
||||
var err error
|
||||
switch whence {
|
||||
case io.SeekStart:
|
||||
case io.SeekCurrent:
|
||||
offset += c.bufferOffset + int64(c.bufferPos)
|
||||
case io.SeekEnd:
|
||||
offset = totalSize + offset
|
||||
}
|
||||
if offset > totalSize {
|
||||
err = io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
for i, chunk := range c.chunkViews {
|
||||
if chunk.LogicOffset <= offset && offset < chunk.LogicOffset+int64(chunk.Size) {
|
||||
if c.isBufferEmpty() || c.bufferOffset != chunk.LogicOffset {
|
||||
c.fetchChunkToBuffer(chunk)
|
||||
c.chunkIndex = i + 1
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
c.bufferPos = int(offset - c.bufferOffset)
|
||||
|
||||
return offset, err
|
||||
|
||||
}
|
||||
|
||||
func (c *ChunkStreamReader) fetchChunkToBuffer(chunkView *ChunkView) error {
|
||||
urlString, err := c.lookupFileId(chunkView.FileId)
|
||||
if err != nil {
|
||||
glog.V(1).Infof("operation LookupFileId %s failed, err: %v", chunkView.FileId, err)
|
||||
return err
|
||||
}
|
||||
var buffer bytes.Buffer
|
||||
err = util.ReadUrlAsStream(urlString, chunkView.CipherKey, chunkView.IsGzipped, chunkView.IsFullChunk, chunkView.Offset, int(chunkView.Size), func(data []byte) {
|
||||
buffer.Write(data)
|
||||
})
|
||||
if err != nil {
|
||||
glog.V(1).Infof("read %s failed, err: %v", chunkView.FileId, err)
|
||||
return err
|
||||
}
|
||||
c.buffer = buffer.Bytes()
|
||||
c.bufferPos = 0
|
||||
c.bufferOffset = chunkView.LogicOffset
|
||||
|
||||
// glog.V(0).Infof("read %s [%d,%d)", chunkView.FileId, chunkView.LogicOffset, chunkView.LogicOffset+int64(chunkView.Size))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func VolumeId(fileId string) string {
|
||||
lastCommaIndex := strings.LastIndex(fileId, ",")
|
||||
if lastCommaIndex > 0 {
|
||||
return fileId[:lastCommaIndex]
|
||||
}
|
||||
return fileId
|
||||
}
|
||||
+91
-74
@@ -1,22 +1,24 @@
|
||||
package filesys
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/seaweedfs/fuse"
|
||||
"github.com/seaweedfs/fuse/fs"
|
||||
)
|
||||
|
||||
type Dir struct {
|
||||
Path string
|
||||
wfs *WFS
|
||||
entry *filer_pb.Entry
|
||||
name string
|
||||
wfs *WFS
|
||||
entry *filer_pb.Entry
|
||||
parent *Dir
|
||||
}
|
||||
|
||||
var _ = fs.Node(&Dir{})
|
||||
@@ -38,32 +40,32 @@ func (dir *Dir) Attr(ctx context.Context, attr *fuse.Attr) error {
|
||||
// https://github.com/bazil/fuse/issues/196
|
||||
attr.Valid = time.Second
|
||||
|
||||
if dir.Path == dir.wfs.option.FilerMountRootPath {
|
||||
if dir.FullPath() == dir.wfs.option.FilerMountRootPath {
|
||||
dir.setRootDirAttributes(attr)
|
||||
glog.V(3).Infof("root dir Attr %s, attr: %+v", dir.Path, attr)
|
||||
glog.V(3).Infof("root dir Attr %s, attr: %+v", dir.FullPath(), attr)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := dir.maybeLoadEntry(); err != nil {
|
||||
glog.V(3).Infof("dir Attr %s,err: %+v", dir.Path, err)
|
||||
glog.V(3).Infof("dir Attr %s,err: %+v", dir.FullPath(), err)
|
||||
return err
|
||||
}
|
||||
|
||||
attr.Inode = filer2.FullPath(dir.Path).AsInode()
|
||||
attr.Inode = util.FullPath(dir.FullPath()).AsInode()
|
||||
attr.Mode = os.FileMode(dir.entry.Attributes.FileMode) | os.ModeDir
|
||||
attr.Mtime = time.Unix(dir.entry.Attributes.Mtime, 0)
|
||||
attr.Crtime = time.Unix(dir.entry.Attributes.Crtime, 0)
|
||||
attr.Gid = dir.entry.Attributes.Gid
|
||||
attr.Uid = dir.entry.Attributes.Uid
|
||||
|
||||
glog.V(3).Infof("dir Attr %s, attr: %+v", dir.Path, attr)
|
||||
glog.V(3).Infof("dir Attr %s, attr: %+v", dir.FullPath(), attr)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dir *Dir) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error {
|
||||
|
||||
glog.V(4).Infof("dir Getxattr %s", dir.Path)
|
||||
glog.V(4).Infof("dir Getxattr %s", dir.FullPath())
|
||||
|
||||
if err := dir.maybeLoadEntry(); err != nil {
|
||||
return err
|
||||
@@ -86,7 +88,7 @@ func (dir *Dir) setRootDirAttributes(attr *fuse.Attr) {
|
||||
}
|
||||
|
||||
func (dir *Dir) newFile(name string, entry *filer_pb.Entry) fs.Node {
|
||||
return dir.wfs.getNode(filer2.NewFullPath(dir.Path, name), func() fs.Node {
|
||||
return dir.wfs.fsNodeCache.EnsureFsNode(util.NewFullPath(dir.FullPath(), name), func() fs.Node {
|
||||
return &File{
|
||||
Name: name,
|
||||
dir: dir,
|
||||
@@ -97,17 +99,19 @@ func (dir *Dir) newFile(name string, entry *filer_pb.Entry) fs.Node {
|
||||
})
|
||||
}
|
||||
|
||||
func (dir *Dir) newDirectory(fullpath filer2.FullPath, entry *filer_pb.Entry) fs.Node {
|
||||
return dir.wfs.getNode(fullpath, func() fs.Node {
|
||||
return &Dir{Path: string(fullpath), wfs: dir.wfs, entry: entry}
|
||||
func (dir *Dir) newDirectory(fullpath util.FullPath, entry *filer_pb.Entry) fs.Node {
|
||||
|
||||
return dir.wfs.fsNodeCache.EnsureFsNode(fullpath, func() fs.Node {
|
||||
return &Dir{name: entry.Name, wfs: dir.wfs, entry: entry, parent: dir}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
|
||||
resp *fuse.CreateResponse) (fs.Node, fs.Handle, error) {
|
||||
|
||||
request := &filer_pb.CreateEntryRequest{
|
||||
Directory: dir.Path,
|
||||
Directory: dir.FullPath(),
|
||||
Entry: &filer_pb.Entry{
|
||||
Name: req.Name,
|
||||
IsDirectory: req.Mode&os.ModeDir > 0,
|
||||
@@ -124,7 +128,7 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
|
||||
},
|
||||
OExcl: req.Flags&fuse.OpenExclusive != 0,
|
||||
}
|
||||
glog.V(1).Infof("create %s/%s: %v", dir.Path, req.Name, req.Flags)
|
||||
glog.V(1).Infof("create %s/%s: %v", dir.FullPath(), req.Name, req.Flags)
|
||||
|
||||
if err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
if err := filer_pb.CreateEntry(client, request); err != nil {
|
||||
@@ -139,7 +143,7 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
|
||||
}
|
||||
var node fs.Node
|
||||
if request.Entry.IsDirectory {
|
||||
node = dir.newDirectory(filer2.NewFullPath(dir.Path, req.Name), request.Entry)
|
||||
node = dir.newDirectory(util.NewFullPath(dir.FullPath(), req.Name), request.Entry)
|
||||
return node, nil, nil
|
||||
}
|
||||
|
||||
@@ -153,6 +157,8 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
|
||||
|
||||
func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error) {
|
||||
|
||||
glog.V(4).Infof("mkdir %s: %s", dir.FullPath(), req.Name)
|
||||
|
||||
newEntry := &filer_pb.Entry{
|
||||
Name: req.Name,
|
||||
IsDirectory: true,
|
||||
@@ -168,13 +174,13 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
|
||||
err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.CreateEntryRequest{
|
||||
Directory: dir.Path,
|
||||
Directory: dir.FullPath(),
|
||||
Entry: newEntry,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("mkdir: %v", request)
|
||||
if err := filer_pb.CreateEntry(client, request); err != nil {
|
||||
glog.V(0).Infof("mkdir %s/%s: %v", dir.Path, req.Name, err)
|
||||
glog.V(0).Infof("mkdir %s/%s: %v", dir.FullPath(), req.Name, err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -182,23 +188,26 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
|
||||
})
|
||||
|
||||
if err == nil {
|
||||
node := dir.newDirectory(filer2.NewFullPath(dir.Path, req.Name), newEntry)
|
||||
node := dir.newDirectory(util.NewFullPath(dir.FullPath(), req.Name), newEntry)
|
||||
|
||||
return node, nil
|
||||
}
|
||||
|
||||
glog.V(0).Infof("mkdir %s/%s: %v", dir.FullPath(), req.Name, err)
|
||||
|
||||
return nil, fuse.EIO
|
||||
}
|
||||
|
||||
func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (node fs.Node, err error) {
|
||||
|
||||
glog.V(4).Infof("dir Lookup %s: %s", dir.Path, req.Name)
|
||||
glog.V(4).Infof("dir Lookup %s: %s", dir.FullPath(), req.Name)
|
||||
|
||||
fullFilePath := filer2.NewFullPath(dir.Path, req.Name)
|
||||
fullFilePath := util.NewFullPath(dir.FullPath(), req.Name)
|
||||
entry := dir.wfs.cacheGet(fullFilePath)
|
||||
|
||||
if entry == nil {
|
||||
// glog.V(3).Infof("dir Lookup cache miss %s", fullFilePath)
|
||||
entry, err = filer2.GetEntry(dir.wfs, fullFilePath)
|
||||
entry, err = filer_pb.GetEntry(dir.wfs, fullFilePath)
|
||||
if err != nil {
|
||||
glog.V(1).Infof("dir GetEntry %s: %v", fullFilePath, err)
|
||||
return nil, fuse.ENOENT
|
||||
@@ -233,12 +242,12 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.
|
||||
|
||||
func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
|
||||
|
||||
glog.V(3).Infof("dir ReadDirAll %s", dir.Path)
|
||||
glog.V(3).Infof("dir ReadDirAll %s", dir.FullPath())
|
||||
|
||||
cacheTtl := 5 * time.Minute
|
||||
|
||||
readErr := filer2.ReadDirAllEntries(dir.wfs, filer2.FullPath(dir.Path), "", func(entry *filer_pb.Entry, isLast bool) {
|
||||
fullpath := filer2.NewFullPath(dir.Path, entry.Name)
|
||||
readErr := filer_pb.ReadDirAllEntries(dir.wfs, util.FullPath(dir.FullPath()), "", func(entry *filer_pb.Entry, isLast bool) {
|
||||
fullpath := util.NewFullPath(dir.FullPath(), entry.Name)
|
||||
inode := fullpath.AsInode()
|
||||
if entry.IsDirectory {
|
||||
dirent := fuse.Dirent{Inode: inode, Name: entry.Name, Type: fuse.DT_Dir}
|
||||
@@ -250,7 +259,7 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
|
||||
dir.wfs.cacheSet(fullpath, entry, cacheTtl)
|
||||
})
|
||||
if readErr != nil {
|
||||
glog.V(0).Infof("list %s: %v", dir.Path, err)
|
||||
glog.V(0).Infof("list %s: %v", dir.FullPath(), err)
|
||||
return ret, fuse.EIO
|
||||
}
|
||||
|
||||
@@ -269,8 +278,8 @@ func (dir *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
||||
|
||||
func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
|
||||
|
||||
filePath := filer2.NewFullPath(dir.Path, req.Name)
|
||||
entry, err := filer2.GetEntry(dir.wfs, filePath)
|
||||
filePath := util.NewFullPath(dir.FullPath(), req.Name)
|
||||
entry, err := filer_pb.GetEntry(dir.wfs, filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -281,54 +290,38 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
|
||||
dir.wfs.deleteFileChunks(entry.Chunks)
|
||||
|
||||
dir.wfs.cacheDelete(filePath)
|
||||
dir.wfs.fsNodeCache.DeleteFsNode(filePath)
|
||||
|
||||
return dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
glog.V(3).Infof("remove file: %v", req)
|
||||
err = filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, false, false, false)
|
||||
if err != nil {
|
||||
glog.V(3).Infof("not found remove file %s/%s: %v", dir.FullPath(), req.Name, err)
|
||||
return fuse.ENOENT
|
||||
}
|
||||
|
||||
request := &filer_pb.DeleteEntryRequest{
|
||||
Directory: dir.Path,
|
||||
Name: req.Name,
|
||||
IsDeleteData: false,
|
||||
}
|
||||
|
||||
glog.V(3).Infof("remove file: %v", request)
|
||||
_, err := client.DeleteEntry(context.Background(), request)
|
||||
if err != nil {
|
||||
glog.V(3).Infof("not found remove file %s/%s: %v", dir.Path, req.Name, err)
|
||||
return fuse.ENOENT
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {
|
||||
|
||||
dir.wfs.cacheDelete(filer2.NewFullPath(dir.Path, req.Name))
|
||||
t := util.NewFullPath(dir.FullPath(), req.Name)
|
||||
dir.wfs.cacheDelete(t)
|
||||
dir.wfs.fsNodeCache.DeleteFsNode(t)
|
||||
|
||||
return dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.DeleteEntryRequest{
|
||||
Directory: dir.Path,
|
||||
Name: req.Name,
|
||||
IsDeleteData: true,
|
||||
}
|
||||
|
||||
glog.V(3).Infof("remove directory entry: %v", request)
|
||||
_, err := client.DeleteEntry(context.Background(), request)
|
||||
if err != nil {
|
||||
glog.V(3).Infof("not found remove %s/%s: %v", dir.Path, req.Name, err)
|
||||
return fuse.ENOENT
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
glog.V(3).Infof("remove directory entry: %v", req)
|
||||
err := filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, true, false, false)
|
||||
if err != nil {
|
||||
glog.V(3).Infof("not found remove %s/%s: %v", dir.FullPath(), req.Name, err)
|
||||
return fuse.ENOENT
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (dir *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error {
|
||||
|
||||
glog.V(3).Infof("%v dir setattr %+v", dir.Path, req)
|
||||
glog.V(3).Infof("%v dir setattr %+v", dir.FullPath(), req)
|
||||
|
||||
if err := dir.maybeLoadEntry(); err != nil {
|
||||
return err
|
||||
@@ -350,7 +343,7 @@ func (dir *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fus
|
||||
dir.entry.Attributes.Mtime = req.Mtime.Unix()
|
||||
}
|
||||
|
||||
dir.wfs.cacheDelete(filer2.FullPath(dir.Path))
|
||||
dir.wfs.cacheDelete(util.FullPath(dir.FullPath()))
|
||||
|
||||
return dir.saveEntry()
|
||||
|
||||
@@ -358,7 +351,7 @@ func (dir *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fus
|
||||
|
||||
func (dir *Dir) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error {
|
||||
|
||||
glog.V(4).Infof("dir Setxattr %s: %s", dir.Path, req.Name)
|
||||
glog.V(4).Infof("dir Setxattr %s: %s", dir.FullPath(), req.Name)
|
||||
|
||||
if err := dir.maybeLoadEntry(); err != nil {
|
||||
return err
|
||||
@@ -368,7 +361,7 @@ func (dir *Dir) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error {
|
||||
return err
|
||||
}
|
||||
|
||||
dir.wfs.cacheDelete(filer2.FullPath(dir.Path))
|
||||
dir.wfs.cacheDelete(util.FullPath(dir.FullPath()))
|
||||
|
||||
return dir.saveEntry()
|
||||
|
||||
@@ -376,7 +369,7 @@ func (dir *Dir) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error {
|
||||
|
||||
func (dir *Dir) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error {
|
||||
|
||||
glog.V(4).Infof("dir Removexattr %s: %s", dir.Path, req.Name)
|
||||
glog.V(4).Infof("dir Removexattr %s: %s", dir.FullPath(), req.Name)
|
||||
|
||||
if err := dir.maybeLoadEntry(); err != nil {
|
||||
return err
|
||||
@@ -386,7 +379,7 @@ func (dir *Dir) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) e
|
||||
return err
|
||||
}
|
||||
|
||||
dir.wfs.cacheDelete(filer2.FullPath(dir.Path))
|
||||
dir.wfs.cacheDelete(util.FullPath(dir.FullPath()))
|
||||
|
||||
return dir.saveEntry()
|
||||
|
||||
@@ -394,7 +387,7 @@ func (dir *Dir) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) e
|
||||
|
||||
func (dir *Dir) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error {
|
||||
|
||||
glog.V(4).Infof("dir Listxattr %s", dir.Path)
|
||||
glog.V(4).Infof("dir Listxattr %s", dir.FullPath())
|
||||
|
||||
if err := dir.maybeLoadEntry(); err != nil {
|
||||
return err
|
||||
@@ -409,14 +402,14 @@ func (dir *Dir) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp
|
||||
}
|
||||
|
||||
func (dir *Dir) Forget() {
|
||||
glog.V(3).Infof("Forget dir %s", dir.Path)
|
||||
glog.V(3).Infof("Forget dir %s", dir.FullPath())
|
||||
|
||||
dir.wfs.forgetNode(filer2.FullPath(dir.Path))
|
||||
dir.wfs.fsNodeCache.DeleteFsNode(util.FullPath(dir.FullPath()))
|
||||
}
|
||||
|
||||
func (dir *Dir) maybeLoadEntry() error {
|
||||
if dir.entry == nil {
|
||||
parentDirPath, name := filer2.FullPath(dir.Path).DirAndName()
|
||||
parentDirPath, name := util.FullPath(dir.FullPath()).DirAndName()
|
||||
entry, err := dir.wfs.maybeLoadEntry(parentDirPath, name)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -428,7 +421,7 @@ func (dir *Dir) maybeLoadEntry() error {
|
||||
|
||||
func (dir *Dir) saveEntry() error {
|
||||
|
||||
parentDir, name := filer2.FullPath(dir.Path).DirAndName()
|
||||
parentDir, name := util.FullPath(dir.FullPath()).DirAndName()
|
||||
|
||||
return dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
@@ -447,3 +440,27 @@ func (dir *Dir) saveEntry() error {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (dir *Dir) FullPath() string {
|
||||
var parts []string
|
||||
for p := dir; p != nil; p = p.parent {
|
||||
if strings.HasPrefix(p.name, "/") {
|
||||
if len(p.name) > 1 {
|
||||
parts = append(parts, p.name[1:])
|
||||
}
|
||||
} else {
|
||||
parts = append(parts, p.name)
|
||||
}
|
||||
}
|
||||
|
||||
if len(parts) == 0 {
|
||||
return "/"
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
for i := len(parts) - 1; i >= 0; i-- {
|
||||
buf.WriteString("/")
|
||||
buf.WriteString(parts[i])
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
@@ -17,10 +17,10 @@ var _ = fs.NodeReadlinker(&File{})
|
||||
|
||||
func (dir *Dir) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (fs.Node, error) {
|
||||
|
||||
glog.V(3).Infof("Symlink: %v/%v to %v", dir.Path, req.NewName, req.Target)
|
||||
glog.V(3).Infof("Symlink: %v/%v to %v", dir.FullPath(), req.NewName, req.Target)
|
||||
|
||||
request := &filer_pb.CreateEntryRequest{
|
||||
Directory: dir.Path,
|
||||
Directory: dir.FullPath(),
|
||||
Entry: &filer_pb.Entry{
|
||||
Name: req.NewName,
|
||||
IsDirectory: false,
|
||||
@@ -37,7 +37,7 @@ func (dir *Dir) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (fs.Node,
|
||||
|
||||
err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
if err := filer_pb.CreateEntry(client, request); err != nil {
|
||||
glog.V(0).Infof("symlink %s/%s: %v", dir.Path, req.NewName, err)
|
||||
glog.V(0).Infof("symlink %s/%s: %v", dir.FullPath(), req.NewName, err)
|
||||
return fuse.EIO
|
||||
}
|
||||
return nil
|
||||
@@ -59,7 +59,7 @@ func (file *File) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (stri
|
||||
return "", fuse.Errno(syscall.EINVAL)
|
||||
}
|
||||
|
||||
glog.V(3).Infof("Readlink: %v/%v => %v", file.dir.Path, file.Name, file.entry.Attributes.SymlinkTarget)
|
||||
glog.V(3).Infof("Readlink: %v/%v => %v", file.dir.FullPath(), file.Name, file.entry.Attributes.SymlinkTarget)
|
||||
|
||||
return file.entry.Attributes.SymlinkTarget, nil
|
||||
|
||||
|
||||
+11
-23
@@ -3,9 +3,9 @@ package filesys
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/seaweedfs/fuse"
|
||||
"github.com/seaweedfs/fuse/fs"
|
||||
)
|
||||
@@ -13,20 +13,24 @@ import (
|
||||
func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirectory fs.Node) error {
|
||||
|
||||
newDir := newDirectory.(*Dir)
|
||||
glog.V(4).Infof("dir Rename %s/%s => %s/%s", dir.Path, req.OldName, newDir.Path, req.NewName)
|
||||
|
||||
newPath := util.NewFullPath(newDir.FullPath(), req.NewName)
|
||||
oldPath := util.NewFullPath(dir.FullPath(), req.OldName)
|
||||
|
||||
glog.V(4).Infof("dir Rename %s => %s", oldPath, newPath)
|
||||
|
||||
err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.AtomicRenameEntryRequest{
|
||||
OldDirectory: dir.Path,
|
||||
OldDirectory: dir.FullPath(),
|
||||
OldName: req.OldName,
|
||||
NewDirectory: newDir.Path,
|
||||
NewDirectory: newDir.FullPath(),
|
||||
NewName: req.NewName,
|
||||
}
|
||||
|
||||
_, err := client.AtomicRenameEntry(context.Background(), request)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("dir Rename %s/%s => %s/%s : %v", dir.Path, req.OldName, newDir.Path, req.NewName, err)
|
||||
glog.V(0).Infof("dir Rename %s => %s : %v", oldPath, newPath, err)
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
@@ -35,28 +39,12 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector
|
||||
})
|
||||
|
||||
if err == nil {
|
||||
newPath := filer2.NewFullPath(newDir.Path, req.NewName)
|
||||
oldPath := filer2.NewFullPath(dir.Path, req.OldName)
|
||||
dir.wfs.cacheDelete(newPath)
|
||||
dir.wfs.cacheDelete(oldPath)
|
||||
|
||||
oldFileNode := dir.wfs.getNode(oldPath, func() fs.Node {
|
||||
return nil
|
||||
})
|
||||
newDirNode := dir.wfs.getNode(filer2.FullPath(dir.Path), func() fs.Node {
|
||||
return nil
|
||||
})
|
||||
dir.wfs.forgetNode(newPath)
|
||||
dir.wfs.forgetNode(oldPath)
|
||||
if oldFileNode != nil && newDirNode != nil {
|
||||
oldFile := oldFileNode.(*File)
|
||||
oldFile.Name = req.NewName
|
||||
oldFile.dir = newDirNode.(*Dir)
|
||||
dir.wfs.getNode(newPath, func() fs.Node {
|
||||
return oldFile
|
||||
})
|
||||
// fmt.Printf("rename path: %v => %v\n", oldPath, newPath)
|
||||
dir.wfs.fsNodeCache.Move(oldPath, newPath)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package filesys
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestDirPath(t *testing.T) {
|
||||
|
||||
p := &Dir{name: "/some"}
|
||||
p = &Dir{name: "path", parent: p}
|
||||
p = &Dir{name: "to", parent: p}
|
||||
p = &Dir{name: "a", parent: p}
|
||||
p = &Dir{name: "file", parent: p}
|
||||
|
||||
assert.Equal(t, "/some/path/to/a/file", p.FullPath())
|
||||
|
||||
p = &Dir{name: "/some"}
|
||||
assert.Equal(t, "/some", p.FullPath())
|
||||
|
||||
p = &Dir{name: "/"}
|
||||
assert.Equal(t, "/", p.FullPath())
|
||||
|
||||
p = &Dir{name: "/"}
|
||||
p = &Dir{name: "path", parent: p}
|
||||
assert.Equal(t, "/path", p.FullPath())
|
||||
|
||||
p = &Dir{name: "/"}
|
||||
p = &Dir{name: "path", parent: p}
|
||||
p = &Dir{name: "to", parent: p}
|
||||
assert.Equal(t, "/path/to", p.FullPath())
|
||||
|
||||
}
|
||||
@@ -78,11 +78,11 @@ func (pages *ContinuousDirtyPages) flushAndSave(offset int64, data []byte) (chun
|
||||
// flush the new page
|
||||
if chunk, err = pages.saveToStorage(bytes.NewReader(data), offset, int64(len(data))); err == nil {
|
||||
if chunk != nil {
|
||||
glog.V(4).Infof("%s/%s flush big request [%d,%d) to %s", pages.f.dir.Path, pages.f.Name, chunk.Offset, chunk.Offset+int64(chunk.Size), chunk.FileId)
|
||||
glog.V(4).Infof("%s/%s flush big request [%d,%d) to %s", pages.f.dir.FullPath(), pages.f.Name, chunk.Offset, chunk.Offset+int64(chunk.Size), chunk.FileId)
|
||||
chunks = append(chunks, chunk)
|
||||
}
|
||||
} else {
|
||||
glog.V(0).Infof("%s/%s failed to flush2 [%d,%d): %v", pages.f.dir.Path, pages.f.Name, chunk.Offset, chunk.Offset+int64(chunk.Size), err)
|
||||
glog.V(0).Infof("%s/%s failed to flush2 [%d,%d): %v", pages.f.dir.FullPath(), pages.f.Name, chunk.Offset, chunk.Offset+int64(chunk.Size), err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ func (pages *ContinuousDirtyPages) saveToStorage(reader io.Reader, offset int64,
|
||||
}
|
||||
|
||||
fileUrl := fmt.Sprintf("http://%s/%s", host, fileId)
|
||||
uploadResult, err := operation.Upload(fileUrl, pages.f.Name, pages.f.wfs.option.Cipher, reader, false, "", nil, auth)
|
||||
uploadResult, err, data := operation.Upload(fileUrl, pages.f.Name, pages.f.wfs.option.Cipher, reader, false, "", nil, auth)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("upload data %v to %s: %v", pages.f.Name, fileUrl, err)
|
||||
return nil, fmt.Errorf("upload data: %v", err)
|
||||
@@ -183,6 +183,7 @@ func (pages *ContinuousDirtyPages) saveToStorage(reader io.Reader, offset int64,
|
||||
glog.V(0).Infof("upload failure %v to %s: %v", pages.f.Name, fileUrl, err)
|
||||
return nil, fmt.Errorf("upload result: %v", uploadResult.Error)
|
||||
}
|
||||
pages.f.wfs.chunkCache.SetChunk(fileId, data)
|
||||
|
||||
return &filer_pb.FileChunk{
|
||||
FileId: fileId,
|
||||
|
||||
@@ -35,6 +35,23 @@ func TestContinuousIntervals_AddIntervalFullOverwrite(t *testing.T) {
|
||||
|
||||
c := &ContinuousIntervals{}
|
||||
|
||||
// 1,
|
||||
c.AddInterval(getBytes(1, 1), 0)
|
||||
// _, 2,
|
||||
c.AddInterval(getBytes(2, 1), 1)
|
||||
// _, _, 3, 3, 3
|
||||
c.AddInterval(getBytes(3, 3), 2)
|
||||
// _, _, _, 4, 4, 4
|
||||
c.AddInterval(getBytes(4, 3), 3)
|
||||
|
||||
expectedData(t, c, 0, 1, 2, 3, 4, 4, 4)
|
||||
|
||||
}
|
||||
|
||||
func TestContinuousIntervals_RealCase1(t *testing.T) {
|
||||
|
||||
c := &ContinuousIntervals{}
|
||||
|
||||
// 25,
|
||||
c.AddInterval(getBytes(25, 1), 0)
|
||||
// _, _, _, _, 23, 23
|
||||
|
||||
+17
-9
@@ -2,6 +2,7 @@ package filesys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
"time"
|
||||
@@ -9,6 +10,7 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/seaweedfs/fuse"
|
||||
"github.com/seaweedfs/fuse/fs"
|
||||
)
|
||||
@@ -32,10 +34,11 @@ type File struct {
|
||||
entry *filer_pb.Entry
|
||||
entryViewCache []filer2.VisibleInterval
|
||||
isOpen int
|
||||
reader io.ReaderAt
|
||||
}
|
||||
|
||||
func (file *File) fullpath() filer2.FullPath {
|
||||
return filer2.NewFullPath(file.dir.Path, file.Name)
|
||||
func (file *File) fullpath() util.FullPath {
|
||||
return util.NewFullPath(file.dir.FullPath(), file.Name)
|
||||
}
|
||||
|
||||
func (file *File) Attr(ctx context.Context, attr *fuse.Attr) error {
|
||||
@@ -69,7 +72,7 @@ func (file *File) Attr(ctx context.Context, attr *fuse.Attr) error {
|
||||
|
||||
func (file *File) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error {
|
||||
|
||||
// glog.V(4).Infof("file Getxattr %s", file.fullpath())
|
||||
glog.V(4).Infof("file Getxattr %s", file.fullpath())
|
||||
|
||||
if err := file.maybeLoadEntry(ctx); err != nil {
|
||||
return err
|
||||
@@ -119,6 +122,7 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
|
||||
}
|
||||
file.entry.Chunks = chunks
|
||||
file.entryViewCache = nil
|
||||
file.reader = nil
|
||||
}
|
||||
file.entry.Attributes.FileSize = req.Size
|
||||
}
|
||||
@@ -207,22 +211,23 @@ func (file *File) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, res
|
||||
func (file *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
|
||||
// fsync works at OS level
|
||||
// write the file chunks to the filerGrpcAddress
|
||||
glog.V(3).Infof("%s/%s fsync file %+v", file.dir.Path, file.Name, req)
|
||||
glog.V(3).Infof("%s/%s fsync file %+v", file.dir.FullPath(), file.Name, req)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (file *File) Forget() {
|
||||
glog.V(3).Infof("Forget file %s/%s", file.dir.Path, file.Name)
|
||||
glog.V(3).Infof("Forget file %s/%s", file.dir.FullPath(), file.Name)
|
||||
|
||||
file.wfs.forgetNode(filer2.NewFullPath(file.dir.Path, file.Name))
|
||||
file.wfs.fsNodeCache.DeleteFsNode(util.NewFullPath(file.dir.FullPath(), file.Name))
|
||||
|
||||
}
|
||||
|
||||
func (file *File) maybeLoadEntry(ctx context.Context) error {
|
||||
if file.entry == nil || file.isOpen <= 0 {
|
||||
entry, err := file.wfs.maybeLoadEntry(file.dir.Path, file.Name)
|
||||
entry, err := file.wfs.maybeLoadEntry(file.dir.FullPath(), file.Name)
|
||||
if err != nil {
|
||||
glog.V(3).Infof("maybeLoadEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err)
|
||||
return err
|
||||
}
|
||||
if entry != nil {
|
||||
@@ -246,6 +251,8 @@ func (file *File) addChunks(chunks []*filer_pb.FileChunk) {
|
||||
newVisibles = t
|
||||
}
|
||||
|
||||
file.reader = nil
|
||||
|
||||
glog.V(3).Infof("%s existing %d chunks adds %d more", file.fullpath(), len(file.entry.Chunks), len(chunks))
|
||||
|
||||
file.entry.Chunks = append(file.entry.Chunks, chunks...)
|
||||
@@ -254,20 +261,21 @@ func (file *File) addChunks(chunks []*filer_pb.FileChunk) {
|
||||
func (file *File) setEntry(entry *filer_pb.Entry) {
|
||||
file.entry = entry
|
||||
file.entryViewCache = filer2.NonOverlappingVisibleIntervals(file.entry.Chunks)
|
||||
file.reader = nil
|
||||
}
|
||||
|
||||
func (file *File) saveEntry() error {
|
||||
return file.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.UpdateEntryRequest{
|
||||
Directory: file.dir.Path,
|
||||
Directory: file.dir.FullPath(),
|
||||
Entry: file.entry,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("save file entry: %v", request)
|
||||
_, err := client.UpdateEntry(context.Background(), request)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("UpdateEntry file %s/%s: %v", file.dir.Path, file.Name, err)
|
||||
glog.V(0).Infof("UpdateEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err)
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package filesys
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"mime"
|
||||
"path"
|
||||
"time"
|
||||
@@ -28,6 +29,7 @@ type FileHandle struct {
|
||||
NodeId fuse.NodeID // file or directory the request is about
|
||||
Uid uint32 // user ID of process making request
|
||||
Gid uint32 // group ID of process making request
|
||||
|
||||
}
|
||||
|
||||
func newFileHandle(file *File, uid, gid uint32) *FileHandle {
|
||||
@@ -85,17 +87,23 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) {
|
||||
|
||||
if fh.f.entryViewCache == nil {
|
||||
fh.f.entryViewCache = filer2.NonOverlappingVisibleIntervals(fh.f.entry.Chunks)
|
||||
fh.f.reader = nil
|
||||
}
|
||||
|
||||
chunkViews := filer2.ViewFromVisibleIntervals(fh.f.entryViewCache, offset, len(buff))
|
||||
if fh.f.reader == nil {
|
||||
chunkViews := filer2.ViewFromVisibleIntervals(fh.f.entryViewCache, 0, math.MaxInt32)
|
||||
fh.f.reader = filer2.NewChunkReaderAtFromClient(fh.f.wfs, chunkViews, fh.f.wfs.chunkCache)
|
||||
}
|
||||
|
||||
totalRead, err := filer2.ReadIntoBuffer(fh.f.wfs, fh.f.fullpath(), buff, chunkViews, offset)
|
||||
totalRead, err := fh.f.reader.ReadAt(buff, offset)
|
||||
|
||||
if err != nil {
|
||||
glog.Errorf("file handle read %s: %v", fh.f.fullpath(), err)
|
||||
}
|
||||
|
||||
return totalRead, err
|
||||
// glog.V(0).Infof("file handle read %s [%d,%d] %d : %v", fh.f.fullpath(), offset, offset+int64(totalRead), totalRead, err)
|
||||
|
||||
return int64(totalRead), err
|
||||
}
|
||||
|
||||
// Write to the file handle
|
||||
@@ -145,6 +153,8 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) err
|
||||
fh.dirtyPages.releaseResource()
|
||||
fh.f.wfs.ReleaseHandle(fh.f.fullpath(), fuse.HandleID(fh.handle))
|
||||
}
|
||||
fh.f.entryViewCache = nil
|
||||
fh.f.reader = nil
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -160,8 +170,8 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
|
||||
return fuse.EIO
|
||||
}
|
||||
|
||||
fh.f.addChunks(chunks)
|
||||
if len(chunks) > 0 {
|
||||
fh.f.addChunks(chunks)
|
||||
fh.dirtyMetadata = true
|
||||
}
|
||||
|
||||
@@ -183,7 +193,7 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
|
||||
}
|
||||
|
||||
request := &filer_pb.CreateEntryRequest{
|
||||
Directory: fh.f.dir.Path,
|
||||
Directory: fh.f.dir.FullPath(),
|
||||
Entry: fh.f.entry,
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
package filesys
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/seaweedfs/fuse/fs"
|
||||
)
|
||||
|
||||
type FsCache struct {
|
||||
root *FsNode
|
||||
}
|
||||
type FsNode struct {
|
||||
parent *FsNode
|
||||
node fs.Node
|
||||
name string
|
||||
childrenLock sync.RWMutex
|
||||
children map[string]*FsNode
|
||||
}
|
||||
|
||||
func newFsCache(root fs.Node) *FsCache {
|
||||
return &FsCache{
|
||||
root: &FsNode{
|
||||
node: root,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (c *FsCache) GetFsNode(path util.FullPath) fs.Node {
|
||||
t := c.root
|
||||
for _, p := range path.Split() {
|
||||
t = t.findChild(p)
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return t.node
|
||||
}
|
||||
|
||||
func (c *FsCache) SetFsNode(path util.FullPath, node fs.Node) {
|
||||
t := c.root
|
||||
for _, p := range path.Split() {
|
||||
t = t.ensureChild(p)
|
||||
}
|
||||
t.node = node
|
||||
}
|
||||
|
||||
func (c *FsCache) EnsureFsNode(path util.FullPath, genNodeFn func() fs.Node) fs.Node {
|
||||
t := c.GetFsNode(path)
|
||||
if t != nil {
|
||||
return t
|
||||
}
|
||||
t = genNodeFn()
|
||||
c.SetFsNode(path, t)
|
||||
return t
|
||||
}
|
||||
|
||||
func (c *FsCache) DeleteFsNode(path util.FullPath) {
|
||||
t := c.root
|
||||
for _, p := range path.Split() {
|
||||
t = t.findChild(p)
|
||||
if t == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if t.parent != nil {
|
||||
t.parent.disconnectChild(t)
|
||||
}
|
||||
t.deleteSelf()
|
||||
}
|
||||
|
||||
// oldPath and newPath are full path including the new name
|
||||
func (c *FsCache) Move(oldPath util.FullPath, newPath util.FullPath) *FsNode {
|
||||
|
||||
// find old node
|
||||
src := c.root
|
||||
for _, p := range oldPath.Split() {
|
||||
src = src.findChild(p)
|
||||
if src == nil {
|
||||
return src
|
||||
}
|
||||
}
|
||||
if src.parent != nil {
|
||||
src.parent.disconnectChild(src)
|
||||
}
|
||||
|
||||
// find new node
|
||||
target := c.root
|
||||
for _, p := range newPath.Split() {
|
||||
target = target.ensureChild(p)
|
||||
}
|
||||
parent := target.parent
|
||||
src.name = target.name
|
||||
if dir, ok := src.node.(*Dir); ok {
|
||||
dir.name = target.name // target is not Dir, but a shortcut
|
||||
}
|
||||
if f, ok := src.node.(*File); ok {
|
||||
f.Name = target.name
|
||||
if f.entry != nil {
|
||||
f.entry.Name = f.Name
|
||||
}
|
||||
}
|
||||
parent.disconnectChild(target)
|
||||
|
||||
target.deleteSelf()
|
||||
|
||||
src.connectToParent(parent)
|
||||
|
||||
return src
|
||||
}
|
||||
|
||||
func (n *FsNode) connectToParent(parent *FsNode) {
|
||||
n.parent = parent
|
||||
oldNode := parent.findChild(n.name)
|
||||
if oldNode != nil {
|
||||
oldNode.deleteSelf()
|
||||
}
|
||||
if dir, ok := n.node.(*Dir); ok {
|
||||
dir.parent = parent.node.(*Dir)
|
||||
}
|
||||
if f, ok := n.node.(*File); ok {
|
||||
f.dir = parent.node.(*Dir)
|
||||
}
|
||||
n.childrenLock.Lock()
|
||||
parent.children[n.name] = n
|
||||
n.childrenLock.Unlock()
|
||||
}
|
||||
|
||||
func (n *FsNode) findChild(name string) *FsNode {
|
||||
n.childrenLock.RLock()
|
||||
defer n.childrenLock.RUnlock()
|
||||
|
||||
child, found := n.children[name]
|
||||
if found {
|
||||
return child
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *FsNode) ensureChild(name string) *FsNode {
|
||||
n.childrenLock.Lock()
|
||||
defer n.childrenLock.Unlock()
|
||||
|
||||
if n.children == nil {
|
||||
n.children = make(map[string]*FsNode)
|
||||
}
|
||||
child, found := n.children[name]
|
||||
if found {
|
||||
return child
|
||||
}
|
||||
t := &FsNode{
|
||||
parent: n,
|
||||
node: nil,
|
||||
name: name,
|
||||
children: nil,
|
||||
}
|
||||
n.children[name] = t
|
||||
return t
|
||||
}
|
||||
|
||||
func (n *FsNode) disconnectChild(child *FsNode) {
|
||||
n.childrenLock.Lock()
|
||||
delete(n.children, child.name)
|
||||
n.childrenLock.Unlock()
|
||||
child.parent = nil
|
||||
}
|
||||
|
||||
func (n *FsNode) deleteSelf() {
|
||||
n.childrenLock.Lock()
|
||||
for _, child := range n.children {
|
||||
child.deleteSelf()
|
||||
}
|
||||
n.children = nil
|
||||
n.childrenLock.Unlock()
|
||||
|
||||
n.node = nil
|
||||
n.parent = nil
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package filesys
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func TestPathSplit(t *testing.T) {
|
||||
parts := util.FullPath("/").Split()
|
||||
if len(parts) != 0 {
|
||||
t.Errorf("expecting an empty list, but getting %d", len(parts))
|
||||
}
|
||||
|
||||
parts = util.FullPath("/readme.md").Split()
|
||||
if len(parts) != 1 {
|
||||
t.Errorf("expecting an empty list, but getting %d", len(parts))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestFsCache(t *testing.T) {
|
||||
|
||||
cache := newFsCache(nil)
|
||||
|
||||
x := cache.GetFsNode(util.FullPath("/y/x"))
|
||||
if x != nil {
|
||||
t.Errorf("wrong node!")
|
||||
}
|
||||
|
||||
p := util.FullPath("/a/b/c")
|
||||
cache.SetFsNode(p, &File{Name: "cc"})
|
||||
tNode := cache.GetFsNode(p)
|
||||
tFile := tNode.(*File)
|
||||
if tFile.Name != "cc" {
|
||||
t.Errorf("expecting a FsNode")
|
||||
}
|
||||
|
||||
cache.SetFsNode(util.FullPath("/a/b/d"), &File{Name: "dd"})
|
||||
cache.SetFsNode(util.FullPath("/a/b/e"), &File{Name: "ee"})
|
||||
cache.SetFsNode(util.FullPath("/a/b/f"), &File{Name: "ff"})
|
||||
cache.SetFsNode(util.FullPath("/z"), &File{Name: "zz"})
|
||||
cache.SetFsNode(util.FullPath("/a"), &File{Name: "aa"})
|
||||
|
||||
b := cache.GetFsNode(util.FullPath("/a/b"))
|
||||
if b != nil {
|
||||
t.Errorf("unexpected node!")
|
||||
}
|
||||
|
||||
a := cache.GetFsNode(util.FullPath("/a"))
|
||||
if a == nil {
|
||||
t.Errorf("missing node!")
|
||||
}
|
||||
|
||||
cache.DeleteFsNode(util.FullPath("/a"))
|
||||
if b != nil {
|
||||
t.Errorf("unexpected node!")
|
||||
}
|
||||
|
||||
a = cache.GetFsNode(util.FullPath("/a"))
|
||||
if a != nil {
|
||||
t.Errorf("wrong DeleteFsNode!")
|
||||
}
|
||||
|
||||
z := cache.GetFsNode(util.FullPath("/z"))
|
||||
if z == nil {
|
||||
t.Errorf("missing node!")
|
||||
}
|
||||
|
||||
y := cache.GetFsNode(util.FullPath("/x/y"))
|
||||
if y != nil {
|
||||
t.Errorf("wrong node!")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestFsCacheMove(t *testing.T) {
|
||||
|
||||
cache := newFsCache(nil)
|
||||
|
||||
cache.SetFsNode(util.FullPath("/a/b/d"), &File{Name: "dd"})
|
||||
cache.SetFsNode(util.FullPath("/a/b/e"), &File{Name: "ee"})
|
||||
cache.SetFsNode(util.FullPath("/z"), &File{Name: "zz"})
|
||||
cache.SetFsNode(util.FullPath("/a"), &File{Name: "aa"})
|
||||
|
||||
cache.Move(util.FullPath("/a/b"), util.FullPath("/z/x"))
|
||||
|
||||
d := cache.GetFsNode(util.FullPath("/z/x/d"))
|
||||
if d == nil {
|
||||
t.Errorf("unexpected nil node!")
|
||||
}
|
||||
if d.(*File).Name != "dd" {
|
||||
t.Errorf("unexpected non dd node!")
|
||||
}
|
||||
|
||||
}
|
||||
+27
-46
@@ -12,26 +12,28 @@ import (
|
||||
"github.com/karlseguin/ccache"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/pb_cache"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/seaweedfs/fuse"
|
||||
"github.com/seaweedfs/fuse/fs"
|
||||
)
|
||||
|
||||
type Option struct {
|
||||
FilerGrpcAddress string
|
||||
GrpcDialOption grpc.DialOption
|
||||
FilerMountRootPath string
|
||||
Collection string
|
||||
Replication string
|
||||
TtlSec int32
|
||||
ChunkSizeLimit int64
|
||||
DataCenter string
|
||||
DirListCacheLimit int64
|
||||
EntryCacheTtl time.Duration
|
||||
Umask os.FileMode
|
||||
FilerGrpcAddress string
|
||||
GrpcDialOption grpc.DialOption
|
||||
FilerMountRootPath string
|
||||
Collection string
|
||||
Replication string
|
||||
TtlSec int32
|
||||
ChunkSizeLimit int64
|
||||
ChunkCacheCountLimit int64
|
||||
DataCenter string
|
||||
DirListCacheLimit int64
|
||||
EntryCacheTtl time.Duration
|
||||
Umask os.FileMode
|
||||
|
||||
MountUid uint32
|
||||
MountGid uint32
|
||||
@@ -54,16 +56,16 @@ type WFS struct {
|
||||
// contains all open handles, protected by handlesLock
|
||||
handlesLock sync.Mutex
|
||||
handles []*FileHandle
|
||||
pathToHandleIndex map[filer2.FullPath]int
|
||||
pathToHandleIndex map[util.FullPath]int
|
||||
|
||||
bufPool sync.Pool
|
||||
|
||||
stats statsCache
|
||||
|
||||
// nodes, protected by nodesLock
|
||||
nodesLock sync.Mutex
|
||||
nodes map[uint64]fs.Node
|
||||
root fs.Node
|
||||
root fs.Node
|
||||
fsNodeCache *FsCache
|
||||
|
||||
chunkCache *pb_cache.ChunkCache
|
||||
}
|
||||
type statsCache struct {
|
||||
filer_pb.StatisticsResponse
|
||||
@@ -74,16 +76,17 @@ func NewSeaweedFileSystem(option *Option) *WFS {
|
||||
wfs := &WFS{
|
||||
option: option,
|
||||
listDirectoryEntriesCache: ccache.New(ccache.Configure().MaxSize(option.DirListCacheLimit * 3).ItemsToPrune(100)),
|
||||
pathToHandleIndex: make(map[filer2.FullPath]int),
|
||||
pathToHandleIndex: make(map[util.FullPath]int),
|
||||
bufPool: sync.Pool{
|
||||
New: func() interface{} {
|
||||
return make([]byte, option.ChunkSizeLimit)
|
||||
},
|
||||
},
|
||||
nodes: make(map[uint64]fs.Node),
|
||||
chunkCache: pb_cache.NewChunkCache(option.ChunkCacheCountLimit),
|
||||
}
|
||||
|
||||
wfs.root = &Dir{Path: wfs.option.FilerMountRootPath, wfs: wfs}
|
||||
wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs}
|
||||
wfs.fsNodeCache = newFsCache(wfs.root)
|
||||
|
||||
return wfs
|
||||
}
|
||||
@@ -139,7 +142,7 @@ func (wfs *WFS) AcquireHandle(file *File, uid, gid uint32) (fileHandle *FileHand
|
||||
return
|
||||
}
|
||||
|
||||
func (wfs *WFS) ReleaseHandle(fullpath filer2.FullPath, handleId fuse.HandleID) {
|
||||
func (wfs *WFS) ReleaseHandle(fullpath util.FullPath, handleId fuse.HandleID) {
|
||||
wfs.handlesLock.Lock()
|
||||
defer wfs.handlesLock.Unlock()
|
||||
|
||||
@@ -214,46 +217,24 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (wfs *WFS) cacheGet(path filer2.FullPath) *filer_pb.Entry {
|
||||
func (wfs *WFS) cacheGet(path util.FullPath) *filer_pb.Entry {
|
||||
item := wfs.listDirectoryEntriesCache.Get(string(path))
|
||||
if item != nil && !item.Expired() {
|
||||
return item.Value().(*filer_pb.Entry)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (wfs *WFS) cacheSet(path filer2.FullPath, entry *filer_pb.Entry, ttl time.Duration) {
|
||||
func (wfs *WFS) cacheSet(path util.FullPath, entry *filer_pb.Entry, ttl time.Duration) {
|
||||
if entry == nil {
|
||||
wfs.listDirectoryEntriesCache.Delete(string(path))
|
||||
} else {
|
||||
wfs.listDirectoryEntriesCache.Set(string(path), entry, ttl)
|
||||
}
|
||||
}
|
||||
func (wfs *WFS) cacheDelete(path filer2.FullPath) {
|
||||
func (wfs *WFS) cacheDelete(path util.FullPath) {
|
||||
wfs.listDirectoryEntriesCache.Delete(string(path))
|
||||
}
|
||||
|
||||
func (wfs *WFS) getNode(fullpath filer2.FullPath, fn func() fs.Node) fs.Node {
|
||||
wfs.nodesLock.Lock()
|
||||
defer wfs.nodesLock.Unlock()
|
||||
|
||||
node, found := wfs.nodes[fullpath.AsInode()]
|
||||
if found {
|
||||
return node
|
||||
}
|
||||
node = fn()
|
||||
if node != nil {
|
||||
wfs.nodes[fullpath.AsInode()] = node
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
func (wfs *WFS) forgetNode(fullpath filer2.FullPath) {
|
||||
wfs.nodesLock.Lock()
|
||||
defer wfs.nodesLock.Unlock()
|
||||
|
||||
delete(wfs.nodes, fullpath.AsInode())
|
||||
}
|
||||
|
||||
func (wfs *WFS) AdjustedUrl(hostAndPort string) string {
|
||||
if !wfs.option.OutsideContainerClusterMode {
|
||||
return hostAndPort
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package filesys
|
||||
|
||||
import (
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/seaweedfs/fuse"
|
||||
)
|
||||
|
||||
@@ -107,7 +107,7 @@ func listxattr(entry *filer_pb.Entry, req *fuse.ListxattrRequest, resp *fuse.Lis
|
||||
|
||||
func (wfs *WFS) maybeLoadEntry(dir, name string) (entry *filer_pb.Entry, err error) {
|
||||
|
||||
fullpath := filer2.NewFullPath(dir, name)
|
||||
fullpath := util.NewFullPath(dir, name)
|
||||
entry = wfs.cacheGet(fullpath)
|
||||
if entry != nil {
|
||||
return
|
||||
|
||||
@@ -6,10 +6,11 @@ import (
|
||||
"image/gif"
|
||||
"image/jpeg"
|
||||
"image/png"
|
||||
"io"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/disintegration/imaging"
|
||||
"io"
|
||||
)
|
||||
|
||||
func Resized(ext string, read io.ReadSeeker, width, height int, mode string) (resized io.ReadSeeker, w int, h int) {
|
||||
@@ -35,6 +36,7 @@ func Resized(ext string, read io.ReadSeeker, width, height int, mode string) (re
|
||||
}
|
||||
}
|
||||
} else {
|
||||
read.Seek(0, 0)
|
||||
return read, bounds.Dx(), bounds.Dy()
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
|
||||
@@ -8,11 +8,10 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"sync"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
@@ -41,12 +40,13 @@ type ChunkManifest struct {
|
||||
|
||||
// seekable chunked file reader
|
||||
type ChunkedFileReader struct {
|
||||
Manifest *ChunkManifest
|
||||
Master string
|
||||
pos int64
|
||||
pr *io.PipeReader
|
||||
pw *io.PipeWriter
|
||||
mutex sync.Mutex
|
||||
totalSize int64
|
||||
chunkList []*ChunkInfo
|
||||
master string
|
||||
pos int64
|
||||
pr *io.PipeReader
|
||||
pw *io.PipeWriter
|
||||
mutex sync.Mutex
|
||||
}
|
||||
|
||||
func (s ChunkList) Len() int { return len(s) }
|
||||
@@ -126,16 +126,29 @@ func readChunkNeedle(fileUrl string, w io.Writer, offset int64) (written int64,
|
||||
return io.Copy(w, resp.Body)
|
||||
}
|
||||
|
||||
func NewChunkedFileReader(chunkList []*ChunkInfo, master string) *ChunkedFileReader {
|
||||
var totalSize int64
|
||||
for _, chunk := range chunkList {
|
||||
totalSize += chunk.Size
|
||||
}
|
||||
sort.Sort(ChunkList(chunkList))
|
||||
return &ChunkedFileReader{
|
||||
totalSize: totalSize,
|
||||
chunkList: chunkList,
|
||||
master: master,
|
||||
}
|
||||
}
|
||||
|
||||
func (cf *ChunkedFileReader) Seek(offset int64, whence int) (int64, error) {
|
||||
var err error
|
||||
switch whence {
|
||||
case 0:
|
||||
case 1:
|
||||
case io.SeekStart:
|
||||
case io.SeekCurrent:
|
||||
offset += cf.pos
|
||||
case 2:
|
||||
offset = cf.Manifest.Size - offset
|
||||
case io.SeekEnd:
|
||||
offset = cf.totalSize + offset
|
||||
}
|
||||
if offset > cf.Manifest.Size {
|
||||
if offset > cf.totalSize {
|
||||
err = ErrInvalidRange
|
||||
}
|
||||
if cf.pos != offset {
|
||||
@@ -146,10 +159,9 @@ func (cf *ChunkedFileReader) Seek(offset int64, whence int) (int64, error) {
|
||||
}
|
||||
|
||||
func (cf *ChunkedFileReader) WriteTo(w io.Writer) (n int64, err error) {
|
||||
cm := cf.Manifest
|
||||
chunkIndex := -1
|
||||
chunkStartOffset := int64(0)
|
||||
for i, ci := range cm.Chunks {
|
||||
for i, ci := range cf.chunkList {
|
||||
if cf.pos >= ci.Offset && cf.pos < ci.Offset+ci.Size {
|
||||
chunkIndex = i
|
||||
chunkStartOffset = cf.pos - ci.Offset
|
||||
@@ -159,10 +171,10 @@ func (cf *ChunkedFileReader) WriteTo(w io.Writer) (n int64, err error) {
|
||||
if chunkIndex < 0 {
|
||||
return n, ErrInvalidRange
|
||||
}
|
||||
for ; chunkIndex < cm.Chunks.Len(); chunkIndex++ {
|
||||
ci := cm.Chunks[chunkIndex]
|
||||
for ; chunkIndex < len(cf.chunkList); chunkIndex++ {
|
||||
ci := cf.chunkList[chunkIndex]
|
||||
// if we need read date from local volume server first?
|
||||
fileUrl, lookupError := LookupFileId(cf.Master, ci.Fid)
|
||||
fileUrl, lookupError := LookupFileId(cf.master, ci.Fid)
|
||||
if lookupError != nil {
|
||||
return n, lookupError
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ func DeleteFilesWithLookupVolumeId(grpcDialOption grpc.DialOption, fileIds []str
|
||||
go func(server string, fidList []string) {
|
||||
defer wg.Done()
|
||||
|
||||
if deleteResults, deleteErr := DeleteFilesAtOneVolumeServer(server, grpcDialOption, fidList); deleteErr != nil {
|
||||
if deleteResults, deleteErr := DeleteFilesAtOneVolumeServer(server, grpcDialOption, fidList, true); deleteErr != nil {
|
||||
err = deleteErr
|
||||
} else if deleteResults != nil {
|
||||
resultChan <- deleteResults
|
||||
@@ -120,12 +120,13 @@ func DeleteFilesWithLookupVolumeId(grpcDialOption grpc.DialOption, fileIds []str
|
||||
}
|
||||
|
||||
// DeleteFilesAtOneVolumeServer deletes a list of files that is on one volume server via gRpc
|
||||
func DeleteFilesAtOneVolumeServer(volumeServer string, grpcDialOption grpc.DialOption, fileIds []string) (ret []*volume_server_pb.DeleteResult, err error) {
|
||||
func DeleteFilesAtOneVolumeServer(volumeServer string, grpcDialOption grpc.DialOption, fileIds []string, includeCookie bool) (ret []*volume_server_pb.DeleteResult, err error) {
|
||||
|
||||
err = WithVolumeServerClient(volumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
|
||||
|
||||
req := &volume_server_pb.BatchDeleteRequest{
|
||||
FileIds: fileIds,
|
||||
FileIds: fileIds,
|
||||
SkipCookieCheck: !includeCookie,
|
||||
}
|
||||
|
||||
resp, err := volumeServerClient.BatchDelete(context.Background(), req)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
||||
)
|
||||
@@ -17,7 +18,7 @@ func WithVolumeServerClient(volumeServer string, grpcDialOption grpc.DialOption,
|
||||
|
||||
grpcAddress, err := toVolumeServerGrpcAddress(volumeServer)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to parse volume server %v: %v", volumeServer, err)
|
||||
}
|
||||
|
||||
return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
|
||||
@@ -41,7 +42,7 @@ func WithMasterServerClient(masterServer string, grpcDialOption grpc.DialOption,
|
||||
|
||||
masterGrpcAddress, parseErr := pb.ParseServerToGrpcAddress(masterServer)
|
||||
if parseErr != nil {
|
||||
return fmt.Errorf("failed to parse master grpc %v: %v", masterServer, parseErr)
|
||||
return fmt.Errorf("failed to parse master %v: %v", masterServer, parseErr)
|
||||
}
|
||||
|
||||
return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
|
||||
@@ -50,3 +51,17 @@ func WithMasterServerClient(masterServer string, grpcDialOption grpc.DialOption,
|
||||
}, masterGrpcAddress, grpcDialOption)
|
||||
|
||||
}
|
||||
|
||||
func WithFilerServerClient(filerServer string, grpcDialOption grpc.DialOption, fn func(masterClient filer_pb.SeaweedFilerClient) error) error {
|
||||
|
||||
filerGrpcAddress, parseErr := pb.ParseServerToGrpcAddress(filerServer)
|
||||
if parseErr != nil {
|
||||
return fmt.Errorf("failed to parse filer %v: %v", filerGrpcAddress, parseErr)
|
||||
}
|
||||
|
||||
return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
|
||||
client := filer_pb.NewSeaweedFilerClient(grpcConnection)
|
||||
return fn(client)
|
||||
}, filerGrpcAddress, grpcDialOption)
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package operation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
||||
)
|
||||
|
||||
func Statistics(server string, grpcDialOption grpc.DialOption, req *master_pb.StatisticsRequest) (resp *master_pb.StatisticsResponse, err error) {
|
||||
|
||||
err = WithMasterServerClient(server, grpcDialOption, func(masterClient master_pb.SeaweedClient) error {
|
||||
|
||||
grpcResponse, grpcErr := masterClient.Statistics(context.Background(), req)
|
||||
if grpcErr != nil {
|
||||
return grpcErr
|
||||
}
|
||||
|
||||
resp = grpcResponse
|
||||
|
||||
return nil
|
||||
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
@@ -191,7 +191,7 @@ func (fi FilePart) Upload(maxMB int, master string, usePublicUrl bool, jwt secur
|
||||
cm.DeleteChunks(master, usePublicUrl, grpcDialOption)
|
||||
}
|
||||
} else {
|
||||
ret, e := Upload(fileUrl, baseName, false, fi.Reader, false, fi.MimeType, nil, jwt)
|
||||
ret, e, _ := Upload(fileUrl, baseName, false, fi.Reader, false, fi.MimeType, nil, jwt)
|
||||
if e != nil {
|
||||
return 0, e
|
||||
}
|
||||
@@ -204,7 +204,7 @@ func upload_one_chunk(filename string, reader io.Reader, master,
|
||||
fileUrl string, jwt security.EncodedJwt,
|
||||
) (size uint32, e error) {
|
||||
glog.V(4).Info("Uploading part ", filename, " to ", fileUrl, "...")
|
||||
uploadResult, uploadError := Upload(fileUrl, filename, false, reader, false, "", nil, jwt)
|
||||
uploadResult, uploadError, _ := Upload(fileUrl, filename, false, reader, false, "", nil, jwt)
|
||||
if uploadError != nil {
|
||||
return 0, uploadError
|
||||
}
|
||||
|
||||
@@ -55,32 +55,36 @@ func UploadData(uploadUrl string, filename string, cipher bool, data []byte, isI
|
||||
}
|
||||
|
||||
// Upload sends a POST request to a volume server to upload the content with fast compression
|
||||
func Upload(uploadUrl string, filename string, cipher bool, reader io.Reader, isInputGzipped bool, mtype string, pairMap map[string]string, jwt security.EncodedJwt) (uploadResult *UploadResult, err error) {
|
||||
func Upload(uploadUrl string, filename string, cipher bool, reader io.Reader, isInputGzipped bool, mtype string, pairMap map[string]string, jwt security.EncodedJwt) (uploadResult *UploadResult, err error, data []byte) {
|
||||
hash := md5.New()
|
||||
reader = io.TeeReader(reader, hash)
|
||||
uploadResult, err = doUpload(uploadUrl, filename, cipher, reader, isInputGzipped, mtype, pairMap, jwt)
|
||||
uploadResult, err, data = doUpload(uploadUrl, filename, cipher, reader, isInputGzipped, mtype, pairMap, jwt)
|
||||
if uploadResult != nil {
|
||||
uploadResult.Md5 = fmt.Sprintf("%x", hash.Sum(nil))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func doUpload(uploadUrl string, filename string, cipher bool, reader io.Reader, isInputGzipped bool, mtype string, pairMap map[string]string, jwt security.EncodedJwt) (uploadResult *UploadResult, err error) {
|
||||
data, readErr := ioutil.ReadAll(reader)
|
||||
if readErr != nil {
|
||||
err = fmt.Errorf("read input: %v", readErr)
|
||||
func doUpload(uploadUrl string, filename string, cipher bool, reader io.Reader, isInputGzipped bool, mtype string, pairMap map[string]string, jwt security.EncodedJwt) (uploadResult *UploadResult, err error, data []byte) {
|
||||
data, err = ioutil.ReadAll(reader)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("read input: %v", err)
|
||||
return
|
||||
}
|
||||
return doUploadData(uploadUrl, filename, cipher, data, isInputGzipped, mtype, pairMap, jwt)
|
||||
uploadResult, uploadErr := doUploadData(uploadUrl, filename, cipher, data, isInputGzipped, mtype, pairMap, jwt)
|
||||
return uploadResult, uploadErr, data
|
||||
}
|
||||
|
||||
func doUploadData(uploadUrl string, filename string, cipher bool, data []byte, isInputGzipped bool, mtype string, pairMap map[string]string, jwt security.EncodedJwt) (uploadResult *UploadResult, err error) {
|
||||
contentIsGzipped := isInputGzipped
|
||||
shouldGzipNow := false
|
||||
if !isInputGzipped {
|
||||
if shouldBeZipped, iAmSure := util.IsGzippableFileType(filepath.Base(filename), mtype); mtype == "" || iAmSure && shouldBeZipped {
|
||||
if shouldBeZipped, iAmSure := util.IsGzippableFileType(filepath.Base(filename), mtype); iAmSure && shouldBeZipped {
|
||||
shouldGzipNow = true
|
||||
contentIsGzipped = true
|
||||
} else if len(data) > 128 {
|
||||
var compressed []byte
|
||||
compressed, err = util.GzipData(data[0:128])
|
||||
shouldGzipNow = len(compressed)*10 < 128*9 // can not compress to less than 90%
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +94,12 @@ func doUploadData(uploadUrl string, filename string, cipher bool, data []byte, i
|
||||
// this could be double copying
|
||||
clearDataLen = len(data)
|
||||
if shouldGzipNow {
|
||||
data, err = util.GzipData(data)
|
||||
compressed, compressErr := util.GzipData(data)
|
||||
// fmt.Printf("data is compressed from %d ==> %d\n", len(data), len(compressed))
|
||||
if compressErr == nil {
|
||||
data = compressed
|
||||
contentIsGzipped = true
|
||||
}
|
||||
} else if isInputGzipped {
|
||||
// just to get the clear data length
|
||||
clearData, err := util.UnGzipData(data)
|
||||
|
||||
+19
-3
@@ -24,9 +24,6 @@ service SeaweedFiler {
|
||||
rpc DeleteEntry (DeleteEntryRequest) returns (DeleteEntryResponse) {
|
||||
}
|
||||
|
||||
rpc StreamDeleteEntries (stream DeleteEntryRequest) returns (stream DeleteEntryResponse) {
|
||||
}
|
||||
|
||||
rpc AtomicRenameEntry (AtomicRenameEntryRequest) returns (AtomicRenameEntryResponse) {
|
||||
}
|
||||
|
||||
@@ -45,6 +42,9 @@ service SeaweedFiler {
|
||||
rpc GetFilerConfiguration (GetFilerConfigurationRequest) returns (GetFilerConfigurationResponse) {
|
||||
}
|
||||
|
||||
rpc ListenForEvents (ListenForEventsRequest) returns (stream FullEventNotification) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
@@ -233,3 +233,19 @@ message GetFilerConfigurationResponse {
|
||||
string dir_queues = 6;
|
||||
bool cipher = 7;
|
||||
}
|
||||
|
||||
message ListenForEventsRequest {
|
||||
string client_name = 1;
|
||||
string path_prefix = 2;
|
||||
int64 since_ns = 3;
|
||||
}
|
||||
message FullEventNotification {
|
||||
string directory = 1;
|
||||
EventNotification event_notification = 2;
|
||||
}
|
||||
|
||||
message LogEntry {
|
||||
int64 ts_ns = 1;
|
||||
int32 partition_key_hash = 2;
|
||||
bytes data = 3;
|
||||
}
|
||||
+272
-173
@@ -39,6 +39,9 @@ It has these top-level messages:
|
||||
StatisticsResponse
|
||||
GetFilerConfigurationRequest
|
||||
GetFilerConfigurationResponse
|
||||
ListenForEventsRequest
|
||||
FullEventNotification
|
||||
LogEntry
|
||||
*/
|
||||
package filer_pb
|
||||
|
||||
@@ -1087,6 +1090,94 @@ func (m *GetFilerConfigurationResponse) GetCipher() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type ListenForEventsRequest struct {
|
||||
ClientName string `protobuf:"bytes,1,opt,name=client_name,json=clientName" json:"client_name,omitempty"`
|
||||
PathPrefix string `protobuf:"bytes,2,opt,name=path_prefix,json=pathPrefix" json:"path_prefix,omitempty"`
|
||||
SinceNs int64 `protobuf:"varint,3,opt,name=since_ns,json=sinceNs" json:"since_ns,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListenForEventsRequest) Reset() { *m = ListenForEventsRequest{} }
|
||||
func (m *ListenForEventsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListenForEventsRequest) ProtoMessage() {}
|
||||
func (*ListenForEventsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
|
||||
|
||||
func (m *ListenForEventsRequest) GetClientName() string {
|
||||
if m != nil {
|
||||
return m.ClientName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListenForEventsRequest) GetPathPrefix() string {
|
||||
if m != nil {
|
||||
return m.PathPrefix
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListenForEventsRequest) GetSinceNs() int64 {
|
||||
if m != nil {
|
||||
return m.SinceNs
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type FullEventNotification struct {
|
||||
Directory string `protobuf:"bytes,1,opt,name=directory" json:"directory,omitempty"`
|
||||
EventNotification *EventNotification `protobuf:"bytes,2,opt,name=event_notification,json=eventNotification" json:"event_notification,omitempty"`
|
||||
}
|
||||
|
||||
func (m *FullEventNotification) Reset() { *m = FullEventNotification{} }
|
||||
func (m *FullEventNotification) String() string { return proto.CompactTextString(m) }
|
||||
func (*FullEventNotification) ProtoMessage() {}
|
||||
func (*FullEventNotification) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
|
||||
|
||||
func (m *FullEventNotification) GetDirectory() string {
|
||||
if m != nil {
|
||||
return m.Directory
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *FullEventNotification) GetEventNotification() *EventNotification {
|
||||
if m != nil {
|
||||
return m.EventNotification
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type LogEntry struct {
|
||||
TsNs int64 `protobuf:"varint,1,opt,name=ts_ns,json=tsNs" json:"ts_ns,omitempty"`
|
||||
PartitionKeyHash int32 `protobuf:"varint,2,opt,name=partition_key_hash,json=partitionKeyHash" json:"partition_key_hash,omitempty"`
|
||||
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LogEntry) Reset() { *m = LogEntry{} }
|
||||
func (m *LogEntry) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogEntry) ProtoMessage() {}
|
||||
func (*LogEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
|
||||
|
||||
func (m *LogEntry) GetTsNs() int64 {
|
||||
if m != nil {
|
||||
return m.TsNs
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetPartitionKeyHash() int32 {
|
||||
if m != nil {
|
||||
return m.PartitionKeyHash
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetData() []byte {
|
||||
if m != nil {
|
||||
return m.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LookupDirectoryEntryRequest)(nil), "filer_pb.LookupDirectoryEntryRequest")
|
||||
proto.RegisterType((*LookupDirectoryEntryResponse)(nil), "filer_pb.LookupDirectoryEntryResponse")
|
||||
@@ -1118,6 +1209,9 @@ func init() {
|
||||
proto.RegisterType((*StatisticsResponse)(nil), "filer_pb.StatisticsResponse")
|
||||
proto.RegisterType((*GetFilerConfigurationRequest)(nil), "filer_pb.GetFilerConfigurationRequest")
|
||||
proto.RegisterType((*GetFilerConfigurationResponse)(nil), "filer_pb.GetFilerConfigurationResponse")
|
||||
proto.RegisterType((*ListenForEventsRequest)(nil), "filer_pb.ListenForEventsRequest")
|
||||
proto.RegisterType((*FullEventNotification)(nil), "filer_pb.FullEventNotification")
|
||||
proto.RegisterType((*LogEntry)(nil), "filer_pb.LogEntry")
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -1136,13 +1230,13 @@ type SeaweedFilerClient interface {
|
||||
CreateEntry(ctx context.Context, in *CreateEntryRequest, opts ...grpc.CallOption) (*CreateEntryResponse, error)
|
||||
UpdateEntry(ctx context.Context, in *UpdateEntryRequest, opts ...grpc.CallOption) (*UpdateEntryResponse, error)
|
||||
DeleteEntry(ctx context.Context, in *DeleteEntryRequest, opts ...grpc.CallOption) (*DeleteEntryResponse, error)
|
||||
StreamDeleteEntries(ctx context.Context, opts ...grpc.CallOption) (SeaweedFiler_StreamDeleteEntriesClient, error)
|
||||
AtomicRenameEntry(ctx context.Context, in *AtomicRenameEntryRequest, opts ...grpc.CallOption) (*AtomicRenameEntryResponse, error)
|
||||
AssignVolume(ctx context.Context, in *AssignVolumeRequest, opts ...grpc.CallOption) (*AssignVolumeResponse, error)
|
||||
LookupVolume(ctx context.Context, in *LookupVolumeRequest, opts ...grpc.CallOption) (*LookupVolumeResponse, error)
|
||||
DeleteCollection(ctx context.Context, in *DeleteCollectionRequest, opts ...grpc.CallOption) (*DeleteCollectionResponse, error)
|
||||
Statistics(ctx context.Context, in *StatisticsRequest, opts ...grpc.CallOption) (*StatisticsResponse, error)
|
||||
GetFilerConfiguration(ctx context.Context, in *GetFilerConfigurationRequest, opts ...grpc.CallOption) (*GetFilerConfigurationResponse, error)
|
||||
ListenForEvents(ctx context.Context, in *ListenForEventsRequest, opts ...grpc.CallOption) (SeaweedFiler_ListenForEventsClient, error)
|
||||
}
|
||||
|
||||
type seaweedFilerClient struct {
|
||||
@@ -1221,37 +1315,6 @@ func (c *seaweedFilerClient) DeleteEntry(ctx context.Context, in *DeleteEntryReq
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *seaweedFilerClient) StreamDeleteEntries(ctx context.Context, opts ...grpc.CallOption) (SeaweedFiler_StreamDeleteEntriesClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_SeaweedFiler_serviceDesc.Streams[1], c.cc, "/filer_pb.SeaweedFiler/StreamDeleteEntries", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &seaweedFilerStreamDeleteEntriesClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type SeaweedFiler_StreamDeleteEntriesClient interface {
|
||||
Send(*DeleteEntryRequest) error
|
||||
Recv() (*DeleteEntryResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type seaweedFilerStreamDeleteEntriesClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *seaweedFilerStreamDeleteEntriesClient) Send(m *DeleteEntryRequest) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *seaweedFilerStreamDeleteEntriesClient) Recv() (*DeleteEntryResponse, error) {
|
||||
m := new(DeleteEntryResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *seaweedFilerClient) AtomicRenameEntry(ctx context.Context, in *AtomicRenameEntryRequest, opts ...grpc.CallOption) (*AtomicRenameEntryResponse, error) {
|
||||
out := new(AtomicRenameEntryResponse)
|
||||
err := grpc.Invoke(ctx, "/filer_pb.SeaweedFiler/AtomicRenameEntry", in, out, c.cc, opts...)
|
||||
@@ -1306,6 +1369,38 @@ func (c *seaweedFilerClient) GetFilerConfiguration(ctx context.Context, in *GetF
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *seaweedFilerClient) ListenForEvents(ctx context.Context, in *ListenForEventsRequest, opts ...grpc.CallOption) (SeaweedFiler_ListenForEventsClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_SeaweedFiler_serviceDesc.Streams[1], c.cc, "/filer_pb.SeaweedFiler/ListenForEvents", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &seaweedFilerListenForEventsClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type SeaweedFiler_ListenForEventsClient interface {
|
||||
Recv() (*FullEventNotification, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type seaweedFilerListenForEventsClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *seaweedFilerListenForEventsClient) Recv() (*FullEventNotification, error) {
|
||||
m := new(FullEventNotification)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for SeaweedFiler service
|
||||
|
||||
type SeaweedFilerServer interface {
|
||||
@@ -1314,13 +1409,13 @@ type SeaweedFilerServer interface {
|
||||
CreateEntry(context.Context, *CreateEntryRequest) (*CreateEntryResponse, error)
|
||||
UpdateEntry(context.Context, *UpdateEntryRequest) (*UpdateEntryResponse, error)
|
||||
DeleteEntry(context.Context, *DeleteEntryRequest) (*DeleteEntryResponse, error)
|
||||
StreamDeleteEntries(SeaweedFiler_StreamDeleteEntriesServer) error
|
||||
AtomicRenameEntry(context.Context, *AtomicRenameEntryRequest) (*AtomicRenameEntryResponse, error)
|
||||
AssignVolume(context.Context, *AssignVolumeRequest) (*AssignVolumeResponse, error)
|
||||
LookupVolume(context.Context, *LookupVolumeRequest) (*LookupVolumeResponse, error)
|
||||
DeleteCollection(context.Context, *DeleteCollectionRequest) (*DeleteCollectionResponse, error)
|
||||
Statistics(context.Context, *StatisticsRequest) (*StatisticsResponse, error)
|
||||
GetFilerConfiguration(context.Context, *GetFilerConfigurationRequest) (*GetFilerConfigurationResponse, error)
|
||||
ListenForEvents(*ListenForEventsRequest, SeaweedFiler_ListenForEventsServer) error
|
||||
}
|
||||
|
||||
func RegisterSeaweedFilerServer(s *grpc.Server, srv SeaweedFilerServer) {
|
||||
@@ -1420,32 +1515,6 @@ func _SeaweedFiler_DeleteEntry_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SeaweedFiler_StreamDeleteEntries_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(SeaweedFilerServer).StreamDeleteEntries(&seaweedFilerStreamDeleteEntriesServer{stream})
|
||||
}
|
||||
|
||||
type SeaweedFiler_StreamDeleteEntriesServer interface {
|
||||
Send(*DeleteEntryResponse) error
|
||||
Recv() (*DeleteEntryRequest, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type seaweedFilerStreamDeleteEntriesServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *seaweedFilerStreamDeleteEntriesServer) Send(m *DeleteEntryResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *seaweedFilerStreamDeleteEntriesServer) Recv() (*DeleteEntryRequest, error) {
|
||||
m := new(DeleteEntryRequest)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func _SeaweedFiler_AtomicRenameEntry_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AtomicRenameEntryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -1554,6 +1623,27 @@ func _SeaweedFiler_GetFilerConfiguration_Handler(srv interface{}, ctx context.Co
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SeaweedFiler_ListenForEvents_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(ListenForEventsRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(SeaweedFilerServer).ListenForEvents(m, &seaweedFilerListenForEventsServer{stream})
|
||||
}
|
||||
|
||||
type SeaweedFiler_ListenForEventsServer interface {
|
||||
Send(*FullEventNotification) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type seaweedFilerListenForEventsServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *seaweedFilerListenForEventsServer) Send(m *FullEventNotification) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "filer_pb.SeaweedFiler",
|
||||
HandlerType: (*SeaweedFilerServer)(nil),
|
||||
@@ -1606,10 +1696,9 @@ var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "StreamDeleteEntries",
|
||||
Handler: _SeaweedFiler_StreamDeleteEntries_Handler,
|
||||
StreamName: "ListenForEvents",
|
||||
Handler: _SeaweedFiler_ListenForEvents_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "filer.proto",
|
||||
@@ -1618,115 +1707,125 @@ var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
|
||||
func init() { proto.RegisterFile("filer.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 1759 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x6f, 0xdb, 0xc8,
|
||||
0x15, 0x0f, 0x25, 0x4b, 0x16, 0x9f, 0xa4, 0xac, 0x3d, 0x72, 0xb2, 0x8a, 0x62, 0xa7, 0x5e, 0xa6,
|
||||
0xd9, 0xba, 0x48, 0xe0, 0x06, 0xee, 0x1e, 0x76, 0xbb, 0xed, 0x21, 0x71, 0x9c, 0x45, 0xd0, 0x24,
|
||||
0x9b, 0xd2, 0x49, 0xb1, 0x45, 0x81, 0x12, 0x34, 0x39, 0x96, 0xa7, 0xa6,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0x41, 0x76, 0x81, 0xb0, 0x34, 0x4a,
|
||||
0x72, 0xc9, 0xde, 0xd3, 0xc3, 0x92, 0x3b, 0x5e, 0xd9, 0x76, 0x76, 0x7a, 0xfe, 0x12, 0x0e, 0xd9,
|
||||
0x80, 0x4e, 0xc2, 0x66, 0x4c, 0x8d, 0x3b, 0xdb, 0xce, 0xce, 0xd0, 0x37, 0x07, 0xef, 0x97, 0x30,
|
||||
0xaa, 0xf9, 0xff, 0xdd, 0x9e, 0xff, 0xe7, 0x16, 0x74, 0x90, 0x50, 0x61, 0xec, 0xcc, 0x31, 0x26,
|
||||
0x1f, 0xc1, 0x80, 0xc9, 0x60, 0x0e, 0x44, 0x0b, 0x7d, 0xeb, 0x33, 0x59, 0x61, 0x4e, 0x1e, 0x42,
|
||||
0x37, 0x3a, 0xc9, 0xd3, 0x53, 0x39, 0x6e, 0x6f, 0xb7, 0x77, 0xfa, 0x7b, 0xa3, 0xf9, 0x45, 0xfa,
|
||||
0xa1, 0xfb, 0x9a, 0xe7, 0x17, 0x22, 0xe4, 0x53, 0x80, 0x50, 0x29, 0xc1, 0x8e, 0x72, 0x45, 0x25,
|
||||
0xbe, 0xb4, 0xbf, 0x37, 0xb6, 0x14, 0x72, 0x49, 0x9f, 0x54, 0x7c, 0xdf, 0x92, 0x25, 0x9f, 0x41,
|
||||
0x8f, 0x9e, 0x2b, 0x9a, 0xc6, 0x34, 0x1e, 0x77, 0xf0, 0xa2, 0xad, 0x85, 0x17, 0xed, 0x1e, 0x14,
|
||||
0x7c, 0xf3, 0xbe, 0x4a, 0x7c, 0xf2, 0x39, 0x0c, 0x6b, 0x2c, 0xb2, 0x06, 0xed, 0x53, 0x5a, 0x46,
|
||||
0x55, 0x7f, 0x6a, 0x64, 0xdf, 0x87, 0x49, 0x6e, 0x12, 0x6c, 0xe0, 0x9b, 0xc3, 0x2f, 0x5a, 0x9f,
|
||||
0x3a, 0xde, 0x33, 0x70, 0x9f, 0xe7, 0x49, 0x52, 0x29, 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 0x9f, 0x69, 0xea, 0xaa, 0x89, 0xa2, 0xfe, 0x26, 0xdb, 0xd0, 0x17,
|
||||
0x34, 0x4b, 0x8a, 0xdc, 0x47, 0xf0, 0x5d, 0xdf, 0x26, 0x91, 0x7b, 0x00, 0x11, 0x4f, 0x12, 0x1a,
|
||||
0xa1, 0x80, 0x8b, 0x02, 0x16, 0x45, 0xe7, 0x9d, 0x52, 0x49, 0x20, 0x69, 0x84, 0x50, 0x77, 0xfc,
|
||||
0xae, 0x52, 0xc9, 0x21, 0x8d, 0xf4, 0x3b, 0x72, 0x49, 0x45, 0x80, 0xed, 0xab, 0x8f, 0x7a, 0x3d,
|
||||
0x4d, 0xc0, 0x26, 0xbb, 0x05, 0x30, 0x15, 0x3c, 0xcf, 0x0c, 0x77, 0xb0, 0xdd, 0xd6, 0x9d, 0x1c,
|
||||
0x29, 0xc8, 0x7e, 0x00, 0x37, 0xe5, 0xc5, 0x2c, 0x61, 0xe9, 0x69, 0xa0, 0x42, 0x31, 0xa5, 0x6a,
|
||||
0x3c, 0x34, 0x15, 0x50, 0x50, 0xdf, 0x22, 0xd1, 0xcb, 0x80, 0xec, 0x0b, 0x1a, 0x2a, 0xfa, 0x1d,
|
||||
0x86, 0xd6, 0xb7, 0xeb, 0x0d, 0xe4, 0x16, 0x74, 0x79, 0x40, 0xcf, 0xa3, 0xa4, 0x28, 0xd1, 0x0e,
|
||||
0x3f, 0x38, 0x8f, 0x12, 0xef, 0x21, 0x8c, 0x6a, 0x37, 0x16, 0x6d, 0x7d, 0x03, 0x3a, 0x54, 0x08,
|
||||
0x5e, 0x36, 0x21, 0x73, 0xf0, 0x7e, 0x07, 0xe4, 0x5d, 0x16, 0xff, 0x10, 0xee, 0x79, 0xb7, 0x60,
|
||||
0x54, 0x33, 0x6d, 0xfc, 0xf0, 0xfe, 0xe9, 0x00, 0x79, 0x86, 0xbd, 0xe4, 0xfb, 0x8d, 0x71, 0x5d,
|
||||
0xdd, 0x7a, 0xc4, 0x98, 0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, 0xf5, 0x64, 0x72, 0xff,
|
||||
0x4a, 0x99, 0xca, 0xf3, 0x2f, 0x61, 0x60, 0x0f, 0x57, 0x62, 0x39, 0xb5, 0x64, 0x7f, 0x98, 0xdc,
|
||||
0xbb, 0x8c, 0x6d, 0x1b, 0xb4, 0xfb, 0xbb, 0x6d, 0x70, 0xc9, 0x84, 0xb3, 0x0d, 0x2e, 0x1b, 0x0b,
|
||||
0xde, 0x0d, 0xf2, 0x7b, 0x58, 0x5b, 0xec, 0xb3, 0xe4, 0xa3, 0x45, 0xe8, 0x1a, 0xed, 0x7b, 0xe2,
|
||||
0x5d, 0x25, 0x52, 0x19, 0x7f, 0x01, 0x30, 0x6f, 0x9f, 0xe4, 0xee, 0x5c, 0xa7, 0xd1, 0xbe, 0x27,
|
||||
0x9b, 0xcb, 0x99, 0x95, 0xa9, 0x3f, 0xc2, 0xad, 0xa5, 0x3d, 0x8a, 0x58, 0x05, 0x78, 0x55, 0x97,
|
||||
0x9b, 0xfc, 0xe4, 0x5a, 0xb9, 0xf2, 0xae, 0xa7, 0xf7, 0x60, 0x4d, 0x9a, 0x16, 0x71, 0x2c, 0x77,
|
||||
0xa3, 0x84, 0xd1, 0x54, 0x3d, 0x05, 0xd4, 0x78, 0x23, 0xb8, 0xe2, 0x47, 0x5d, 0xfc, 0x37, 0xee,
|
||||
0xe7, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x35, 0x0b, 0x9e, 0x2e, 0x9c, 0x13, 0x00, 0x00,
|
||||
// 1909 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x58, 0x5f, 0x6f, 0xdc, 0xc6,
|
||||
0x11, 0x37, 0xef, 0x74, 0x7f, 0x38, 0x77, 0x67, 0x4b, 0x7b, 0xb2, 0x73, 0x3e, 0x4b, 0xb6, 0x42,
|
||||
0xd7, 0xa9, 0x0b, 0x1b, 0xaa, 0xa1, 0xe6, 0x21, 0x69, 0xda, 0x07, 0x5b, 0x96, 0x52, 0x37, 0xb6,
|
||||
0xe2, 0x52, 0x76, 0x91, 0xa2, 0x40, 0x09, 0x8a, 0x5c, 0xdd, 0x6d, 0xc5, 0x23, 0x99, 0xdd, 0xa5,
|
||||
0xfe, 0xe4, 0xad, 0x5f, 0xa3, 0x40, 0x1f, 0xfa, 0x1d, 0xfa, 0x58, 0xf4, 0xa5, 0x28, 0xd0, 0xcf,
|
||||
0xd1, 0xc7, 0x3e, 0xf4, 0x33, 0x14, 0x3b, 0x4b, 0xf2, 0x96, 0xc7, 0x93, 0x94, 0x20, 0xc8, 0x1b,
|
||||
0x77, 0x66, 0x76, 0x76, 0x76, 0xfe, 0xfc, 0x66, 0x96, 0xd0, 0x3b, 0x66, 0x11, 0xe5, 0xdb, 0x29,
|
||||
0x4f, 0x64, 0x42, 0xba, 0xb8, 0xf0, 0xd2, 0x23, 0xe7, 0x4b, 0xb8, 0xf7, 0x3a, 0x49, 0x4e, 0xb2,
|
||||
0xf4, 0x25, 0xe3, 0x34, 0x90, 0x09, 0xbf, 0xd8, 0x8b, 0x25, 0xbf, 0x70, 0xe9, 0xd7, 0x19, 0x15,
|
||||
0x92, 0x6c, 0x80, 0x1d, 0x16, 0x8c, 0x91, 0xb5, 0x65, 0x3d, 0xb6, 0xdd, 0x39, 0x81, 0x10, 0x58,
|
||||
0x89, 0xfd, 0x19, 0x1d, 0x35, 0x90, 0x81, 0xdf, 0xce, 0x1e, 0x6c, 0x2c, 0x57, 0x28, 0xd2, 0x24,
|
||||
0x16, 0x94, 0x3c, 0x82, 0x16, 0x55, 0x04, 0xd4, 0xd6, 0xdb, 0xb9, 0xb5, 0x5d, 0x98, 0xb2, 0xad,
|
||||
0xe5, 0x34, 0xd7, 0xf9, 0x87, 0x05, 0xe4, 0x35, 0x13, 0x52, 0x11, 0x19, 0x15, 0xdf, 0xce, 0x9e,
|
||||
0x3b, 0xd0, 0x4e, 0x39, 0x3d, 0x66, 0xe7, 0xb9, 0x45, 0xf9, 0x8a, 0x3c, 0x85, 0x35, 0x21, 0x7d,
|
||||
0x2e, 0xf7, 0x79, 0x32, 0xdb, 0x67, 0x11, 0x3d, 0x50, 0x46, 0x37, 0x51, 0xa4, 0xce, 0x20, 0xdb,
|
||||
0x40, 0x58, 0x1c, 0x44, 0x99, 0x60, 0xa7, 0xf4, 0xb0, 0xe0, 0x8e, 0x56, 0xb6, 0xac, 0xc7, 0x5d,
|
||||
0x77, 0x09, 0x87, 0xac, 0x43, 0x2b, 0x62, 0x33, 0x26, 0x47, 0xad, 0x2d, 0xeb, 0xf1, 0xc0, 0xd5,
|
||||
0x0b, 0xe7, 0x17, 0x30, 0xac, 0xd8, 0xff, 0xdd, 0xae, 0xff, 0x97, 0x06, 0xb4, 0x90, 0x50, 0xfa,
|
||||
0xd8, 0x9a, 0xfb, 0x98, 0x7c, 0x08, 0x7d, 0x26, 0xbc, 0xb9, 0x23, 0x1a, 0x68, 0x5b, 0x8f, 0x89,
|
||||
0xd2, 0xe7, 0xe4, 0x09, 0xb4, 0x83, 0x69, 0x16, 0x9f, 0x88, 0x51, 0x73, 0xab, 0xf9, 0xb8, 0xb7,
|
||||
0x33, 0x9c, 0x1f, 0xa4, 0x2e, 0xba, 0xab, 0x78, 0x6e, 0x2e, 0x42, 0x3e, 0x01, 0xf0, 0xa5, 0xe4,
|
||||
0xec, 0x28, 0x93, 0x54, 0xe0, 0x4d, 0x7b, 0x3b, 0x23, 0x63, 0x43, 0x26, 0xe8, 0xf3, 0x92, 0xef,
|
||||
0x1a, 0xb2, 0xe4, 0x53, 0xe8, 0xd2, 0x73, 0x49, 0xe3, 0x90, 0x86, 0xa3, 0x16, 0x1e, 0xb4, 0xb9,
|
||||
0x70, 0xa3, 0xed, 0xbd, 0x9c, 0xaf, 0xef, 0x57, 0x8a, 0x8f, 0x3f, 0x83, 0x41, 0x85, 0x45, 0x56,
|
||||
0xa1, 0x79, 0x42, 0x8b, 0xa8, 0x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 0xfe, 0x65, 0x6c, 0x53, 0xa1, 0xd9, 0xe3, 0x4c, 0x85, 0x4b, 0xba, 0xbc, 0xa9,
|
||||
0x70, 0x59, 0x6b, 0x74, 0x6e, 0x90, 0xdf, 0xc3, 0xea, 0x62, 0xaf, 0x21, 0x1f, 0x2e, 0xba, 0xad,
|
||||
0xd6, 0xc2, 0xc6, 0xce, 0x55, 0x22, 0xa5, 0xf2, 0x57, 0x00, 0xf3, 0x16, 0x42, 0x8c, 0x9a, 0xad,
|
||||
0xb5, 0xb0, 0xf1, 0xc6, 0x72, 0x66, 0xa9, 0xea, 0x8f, 0x70, 0x7b, 0x29, 0x4e, 0x13, 0xa3, 0x4c,
|
||||
0xae, 0x42, 0xfa, 0xf1, 0x8f, 0xaf, 0x95, 0x2b, 0xcf, 0xfa, 0x0a, 0x6e, 0x2d, 0xe0, 0x24, 0xd9,
|
||||
0xaa, 0x56, 0x4d, 0x1d, 0x42, 0xc7, 0x0f, 0xcc, 0x9f, 0x4f, 0x4b, 0xc0, 0x4e, 0x55, 0xd6, 0x8b,
|
||||
0xfb, 0xb0, 0x2a, 0x34, 0x44, 0x1c, 0x8b, 0x6d, 0x0d, 0xaf, 0x2f, 0x00, 0x6d, 0x79, 0xcb, 0x13,
|
||||
0x99, 0x1c, 0xb5, 0xf1, 0x5f, 0xe7, 0xcf, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x4d, 0x32, 0x75,
|
||||
0x14, 0xfa, 0x14, 0x00, 0x00,
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package filer_pb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
var (
|
||||
OS_UID = uint32(os.Getuid())
|
||||
OS_GID = uint32(os.Getgid())
|
||||
)
|
||||
|
||||
type FilerClient interface {
|
||||
WithFilerClient(fn func(SeaweedFilerClient) error) error
|
||||
AdjustedUrl(hostAndPort string) string
|
||||
}
|
||||
|
||||
func GetEntry(filerClient FilerClient, fullFilePath util.FullPath) (entry *Entry, err error) {
|
||||
|
||||
dir, name := fullFilePath.DirAndName()
|
||||
|
||||
err = filerClient.WithFilerClient(func(client SeaweedFilerClient) error {
|
||||
|
||||
request := &LookupDirectoryEntryRequest{
|
||||
Directory: dir,
|
||||
Name: name,
|
||||
}
|
||||
|
||||
// glog.V(3).Infof("read %s request: %v", fullFilePath, request)
|
||||
resp, err := LookupEntry(client, request)
|
||||
if err != nil {
|
||||
if err == ErrNotFound {
|
||||
return nil
|
||||
}
|
||||
glog.V(3).Infof("read %s %v: %v", fullFilePath, resp, err)
|
||||
return err
|
||||
}
|
||||
|
||||
if resp.Entry == nil {
|
||||
// glog.V(3).Infof("read %s entry: %v", fullFilePath, entry)
|
||||
return nil
|
||||
}
|
||||
|
||||
entry = resp.Entry
|
||||
return nil
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ReadDirAllEntries(filerClient FilerClient, fullDirPath util.FullPath, prefix string, fn func(entry *Entry, isLast bool)) (err error) {
|
||||
|
||||
return doList(filerClient, fullDirPath, prefix, fn, "", false, math.MaxUint32)
|
||||
|
||||
}
|
||||
|
||||
func List(filerClient FilerClient, parentDirectoryPath, prefix string, fn func(entry *Entry, isLast bool), startFrom string, inclusive bool, limit uint32) (err error) {
|
||||
|
||||
return doList(filerClient, util.FullPath(parentDirectoryPath), prefix, fn, startFrom, inclusive, limit)
|
||||
|
||||
}
|
||||
|
||||
func doList(filerClient FilerClient, fullDirPath util.FullPath, prefix string, fn func(entry *Entry, isLast bool), startFrom string, inclusive bool, limit uint32) (err error) {
|
||||
|
||||
err = filerClient.WithFilerClient(func(client SeaweedFilerClient) error {
|
||||
|
||||
request := &ListEntriesRequest{
|
||||
Directory: string(fullDirPath),
|
||||
Prefix: prefix,
|
||||
StartFromFileName: startFrom,
|
||||
Limit: limit,
|
||||
InclusiveStartFrom: inclusive,
|
||||
}
|
||||
|
||||
glog.V(3).Infof("read directory: %v", request)
|
||||
stream, err := client.ListEntries(context.Background(), request)
|
||||
if err != nil {
|
||||
return fmt.Errorf("list %s: %v", fullDirPath, err)
|
||||
}
|
||||
|
||||
var prevEntry *Entry
|
||||
for {
|
||||
resp, recvErr := stream.Recv()
|
||||
if recvErr != nil {
|
||||
if recvErr == io.EOF {
|
||||
if prevEntry != nil {
|
||||
fn(prevEntry, true)
|
||||
}
|
||||
break
|
||||
} else {
|
||||
return recvErr
|
||||
}
|
||||
}
|
||||
if prevEntry != nil {
|
||||
fn(prevEntry, false)
|
||||
}
|
||||
prevEntry = resp.Entry
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func Exists(filerClient FilerClient, parentDirectoryPath string, entryName string, isDirectory bool) (exists bool, err error) {
|
||||
|
||||
err = filerClient.WithFilerClient(func(client SeaweedFilerClient) error {
|
||||
|
||||
request := &LookupDirectoryEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Name: entryName,
|
||||
}
|
||||
|
||||
glog.V(4).Infof("exists entry %v/%v: %v", parentDirectoryPath, entryName, request)
|
||||
resp, err := LookupEntry(client, request)
|
||||
if err != nil {
|
||||
if err == ErrNotFound {
|
||||
exists = false
|
||||
return nil
|
||||
}
|
||||
glog.V(0).Infof("exists entry %v: %v", request, err)
|
||||
return fmt.Errorf("exists entry %s/%s: %v", parentDirectoryPath, entryName, err)
|
||||
}
|
||||
|
||||
exists = resp.Entry.IsDirectory == isDirectory
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func Mkdir(filerClient FilerClient, parentDirectoryPath string, dirName string, fn func(entry *Entry)) error {
|
||||
return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {
|
||||
|
||||
entry := &Entry{
|
||||
Name: dirName,
|
||||
IsDirectory: true,
|
||||
Attributes: &FuseAttributes{
|
||||
Mtime: time.Now().Unix(),
|
||||
Crtime: time.Now().Unix(),
|
||||
FileMode: uint32(0777 | os.ModeDir),
|
||||
Uid: OS_UID,
|
||||
Gid: OS_GID,
|
||||
},
|
||||
}
|
||||
|
||||
if fn != nil {
|
||||
fn(entry)
|
||||
}
|
||||
|
||||
request := &CreateEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Entry: entry,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("mkdir: %v", request)
|
||||
if err := CreateEntry(client, request); err != nil {
|
||||
glog.V(0).Infof("mkdir %v: %v", request, err)
|
||||
return fmt.Errorf("mkdir %s/%s: %v", parentDirectoryPath, dirName, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func MkFile(filerClient FilerClient, parentDirectoryPath string, fileName string, chunks []*FileChunk) error {
|
||||
return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {
|
||||
|
||||
entry := &Entry{
|
||||
Name: fileName,
|
||||
IsDirectory: false,
|
||||
Attributes: &FuseAttributes{
|
||||
Mtime: time.Now().Unix(),
|
||||
Crtime: time.Now().Unix(),
|
||||
FileMode: uint32(0770),
|
||||
Uid: OS_UID,
|
||||
Gid: OS_GID,
|
||||
},
|
||||
Chunks: chunks,
|
||||
}
|
||||
|
||||
request := &CreateEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Entry: entry,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("create file: %s/%s", parentDirectoryPath, fileName)
|
||||
if err := CreateEntry(client, request); err != nil {
|
||||
glog.V(0).Infof("create file %v:%v", request, err)
|
||||
return fmt.Errorf("create file %s/%s: %v", parentDirectoryPath, fileName, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func Remove(filerClient FilerClient, parentDirectoryPath string, name string, isDeleteData, isRecursive, ignoreRecursiveErr bool) error {
|
||||
return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {
|
||||
|
||||
if resp, err := client.DeleteEntry(context.Background(), &DeleteEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Name: name,
|
||||
IsDeleteData: isDeleteData,
|
||||
IsRecursive: isRecursive,
|
||||
IgnoreRecursiveError: ignoreRecursiveErr,
|
||||
}); err != nil {
|
||||
return err
|
||||
} else {
|
||||
if resp.Error != "" {
|
||||
return errors.New(resp.Error)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
})
|
||||
}
|
||||
@@ -16,6 +16,10 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
||||
)
|
||||
|
||||
const (
|
||||
Max_Message_Size = 1 << 30 // 1 GB
|
||||
)
|
||||
|
||||
var (
|
||||
// cache grpc connections
|
||||
grpcClients = make(map[string]*grpc.ClientConn)
|
||||
@@ -28,13 +32,18 @@ func init() {
|
||||
|
||||
func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server {
|
||||
var options []grpc.ServerOption
|
||||
options = append(options, grpc.KeepaliveParams(keepalive.ServerParameters{
|
||||
Time: 10 * time.Second, // wait time before ping if no activity
|
||||
Timeout: 20 * time.Second, // ping timeout
|
||||
}), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
||||
MinTime: 60 * time.Second, // min time a client should wait before sending a ping
|
||||
PermitWithoutStream: true,
|
||||
}))
|
||||
options = append(options,
|
||||
grpc.KeepaliveParams(keepalive.ServerParameters{
|
||||
Time: 10 * time.Second, // wait time before ping if no activity
|
||||
Timeout: 20 * time.Second, // ping timeout
|
||||
}),
|
||||
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
||||
MinTime: 60 * time.Second, // min time a client should wait before sending a ping
|
||||
PermitWithoutStream: true,
|
||||
}),
|
||||
grpc.MaxRecvMsgSize(Max_Message_Size),
|
||||
grpc.MaxSendMsgSize(Max_Message_Size),
|
||||
)
|
||||
for _, opt := range opts {
|
||||
if opt != nil {
|
||||
options = append(options, opt)
|
||||
@@ -49,6 +58,10 @@ func GrpcDial(ctx context.Context, address string, opts ...grpc.DialOption) (*gr
|
||||
var options []grpc.DialOption
|
||||
options = append(options,
|
||||
// grpc.WithInsecure(),
|
||||
grpc.WithDefaultCallOptions(
|
||||
grpc.MaxCallSendMsgSize(Max_Message_Size),
|
||||
grpc.MaxCallRecvMsgSize(Max_Message_Size),
|
||||
),
|
||||
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||
Time: 30 * time.Second, // client ping server if no activity for this long
|
||||
Timeout: 20 * time.Second,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package pb_cache
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/karlseguin/ccache"
|
||||
)
|
||||
|
||||
// a global cache for recently accessed file chunks
|
||||
type ChunkCache struct {
|
||||
cache *ccache.Cache
|
||||
}
|
||||
|
||||
func NewChunkCache(maxEntries int64) *ChunkCache {
|
||||
pruneCount := maxEntries >> 3
|
||||
if pruneCount <= 0 {
|
||||
pruneCount = 500
|
||||
}
|
||||
return &ChunkCache{
|
||||
cache: ccache.New(ccache.Configure().MaxSize(maxEntries).ItemsToPrune(uint32(pruneCount))),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ChunkCache) GetChunk(fileId string) []byte {
|
||||
item := c.cache.Get(fileId)
|
||||
if item == nil {
|
||||
return nil
|
||||
}
|
||||
data := item.Value().([]byte)
|
||||
item.Extend(time.Hour)
|
||||
return data
|
||||
}
|
||||
|
||||
func (c *ChunkCache) SetChunk(fileId string, data []byte) {
|
||||
c.cache.Set(fileId, data, time.Hour)
|
||||
}
|
||||
@@ -94,6 +94,7 @@ service VolumeServer {
|
||||
|
||||
message BatchDeleteRequest {
|
||||
repeated string file_ids = 1;
|
||||
bool skip_cookie_check = 2;
|
||||
}
|
||||
|
||||
message BatchDeleteResponse {
|
||||
|
||||
@@ -105,7 +105,8 @@ var _ = math.Inf
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type BatchDeleteRequest struct {
|
||||
FileIds []string `protobuf:"bytes,1,rep,name=file_ids,json=fileIds" json:"file_ids,omitempty"`
|
||||
FileIds []string `protobuf:"bytes,1,rep,name=file_ids,json=fileIds" json:"file_ids,omitempty"`
|
||||
SkipCookieCheck bool `protobuf:"varint,2,opt,name=skip_cookie_check,json=skipCookieCheck" json:"skip_cookie_check,omitempty"`
|
||||
}
|
||||
|
||||
func (m *BatchDeleteRequest) Reset() { *m = BatchDeleteRequest{} }
|
||||
@@ -120,6 +121,13 @@ func (m *BatchDeleteRequest) GetFileIds() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *BatchDeleteRequest) GetSkipCookieCheck() bool {
|
||||
if m != nil {
|
||||
return m.SkipCookieCheck
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type BatchDeleteResponse struct {
|
||||
Results []*DeleteResult `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
|
||||
}
|
||||
@@ -3681,212 +3689,214 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
|
||||
func init() { proto.RegisterFile("volume_server.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 3302 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xd4, 0x1b, 0x4d, 0x6f, 0xdc, 0xd6,
|
||||
0x51, 0xd4, 0xea, 0x63, 0x77, 0x76, 0xd7, 0x92, 0x9f, 0x1c, 0x79, 0x43, 0x49, 0xb6, 0x4c, 0xe7,
|
||||
0x43, 0x72, 0x62, 0xc9, 0x51, 0x92, 0xc6, 0x71, 0x9a, 0x34, 0xb6, 0x6c, 0x39, 0x4e, 0x2c, 0x39,
|
||||
0xa1, 0x1c, 0xa7, 0x6d, 0x82, 0x12, 0x14, 0xf9, 0x56, 0x62, 0xc4, 0x25, 0x69, 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4, 0xa3, 0xce, 0xf8, 0xb2, 0xb2,
|
||||
0x32, 0xa9, 0x8b, 0x11, 0x3a, 0x07, 0x93, 0x38, 0x0c, 0xfd, 0xb0, 0x53, 0x63, 0xe8, 0x7c, 0x80,
|
||||
0x10, 0x4c, 0x44, 0xce, 0x53, 0xdc, 0x99, 0x58, 0x56, 0x56, 0xda, 0x3a, 0xfb, 0x46, 0x1d, 0x98,
|
||||
0x3e, 0xc2, 0x61, 0xe4, 0xf8, 0x5e, 0x67, 0x92, 0x81, 0xe5, 0x50, 0xfb, 0x10, 0xce, 0x6c, 0x39,
|
||||
0x2e, 0xbe, 0x8b, 0x89, 0xd4, 0x41, 0xe9, 0x36, 0x2e, 0x42, 0xd3, 0xb4, 0x2c, 0x1c, 0x10, 0x63,
|
||||
0xff, 0xa9, 0x13, 0xb0, 0xbd, 0xd4, 0x75, 0xe0, 0xa0, 0xbb, 0x4f, 0x9d, 0x40, 0xfb, 0x69, 0x0d,
|
||||
0x66, 0x62, 0x62, 0x42, 0x3f, 0x08, 0x26, 0x6c, 0x93, 0x98, 0x8c, 0x54, 0x4b, 0x67, 0xdf, 0xe8,
|
||||
0x45, 0x38, 0x63, 0xf9, 0x1e, 0xc1, 0x1e, 0x31, 0x5c, 0xec, 0xed, 0x93, 0x03, 0x46, 0xab, 0xad,
|
||||
0xb7, 0x05, 0xf4, 0x3e, 0x03, 0xa2, 0x4b, 0xd0, 0x92, 0x68, 0x64, 0x10, 0x60, 0x21, 0x65, 0x53,
|
||||
0xc0, 0x1e, 0x0e, 0x02, 0x8c, 0x2e, 0x43, 0xdb, 0x35, 0x23, 0x62, 0xf4, 0x7c, 0xdb, 0xe9, 0x3a,
|
||||
0xd8, 0x66, 0x42, 0x4f, 0xe8, 0x2d, 0x0a, 0xdc, 0x16, 0x30, 0xa4, 0xf2, 0x43, 0xf5, 0xcc, 0x1e,
|
||||
0x66, 0xd2, 0x37, 0xf4, 0x78, 0x4c, 0xb7, 0x87, 0x89, 0xb9, 0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x96, 0xa1, 0x19, 0x84, 0xd8, 0x74, 0x5d, 0xdf,
|
||||
0x32, 0x09, 0x17, 0xaf, 0xa6, 0x27, 0x41, 0xda, 0x12, 0x2c, 0x14, 0x12, 0xe7, 0x1b, 0xd4, 0xae,
|
||||
0x67, 0x76, 0xef, 0xf7, 0x7a, 0x4e, 0x25, 0xd6, 0xda, 0x7b, 0xb9, 0x5d, 0xb3, 0x95, 0x42, 0xf0,
|
||||
0x65, 0x68, 0x39, 0x91, 0x11, 0x62, 0xd3, 0x36, 0x7c, 0xcf, 0xe5, 0x87, 0x51, 0xd7, 0xc1, 0x89,
|
||||
0x74, 0x6c, 0xda, 0x0f, 0x3c, 0x77, 0xa0, 0xbd, 0x9d, 0x59, 0xef, 0x62, 0xd3, 0xeb, 0x07, 0x95,
|
||||
0x58, 0x67, 0x65, 0x92, 0x4b, 0x85, 0x4c, 0x6f, 0xc3, 0x79, 0x1e, 0x2e, 0x36, 0x7d, 0xd7, 0xc5,
|
||||
0x16, 0x71, 0x7c, 0x4f, 0x92, 0xbd, 0x00, 0x60, 0xc5, 0x40, 0x61, 0x21, 0x09, 0x88, 0xa6, 0x42,
|
||||
0x27, 0xbf, 0x54, 0x90, 0xfd, 0x8b, 0x02, 0xcf, 0xdd, 0x14, 0x6a, 0xe5, 0x8c, 0x2b, 0x1d, 0x51,
|
||||
0x9a, 0xe5, 0x78, 0x96, 0x65, 0xf6, 0x08, 0x6b, 0xb9, 0x23, 0xa4, 0x18, 0x21, 0x0e, 0x5c, 0xc7,
|
||||
0x32, 0x19, 0x89, 0x09, 0xee, 0xdd, 0x09, 0x10, 0xb5, 0x78, 0x42, 0x5c, 0xe1, 0xb3, 0xf4, 0x13,
|
||||
0x6d, 0xc0, 0x7c, 0x0f, 0xf7, 0xfc, 0x70, 0x60, 0xf4, 0xcc, 0xc0, 0xe8, 0x99, 0x4f, 0x0c, 0x1a,
|
||||
0xde, 0x8c, 0xde, 0x1e, 0x73, 0xe0, 0xb6, 0x8e, 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aa, 0x39, 0xfc, 0x73, 0x30, 0x97, 0x5a, 0x22, 0x6c, 0xe3, 0x75,
|
||||
0x38, 0xc7, 0xc1, 0x9f, 0x7a, 0xbd, 0xca, 0xb4, 0xce, 0xc3, 0x73, 0x99, 0x45, 0x82, 0xda, 0x86,
|
||||
0x64, 0x92, 0x4e, 0x37, 0x8e, 0x25, 0x36, 0x2f, 0x77, 0x90, 0xce, 0x38, 0x58, 0x6c, 0xe3, 0x1b,
|
||||
0x36, 0xc3, 0x43, 0x1a, 0x77, 0x68, 0x24, 0xaa, 0x44, 0x71, 0x11, 0xd4, 0xa2, 0x95, 0x82, 0xee,
|
||||
0x67, 0x30, 0x2f, 0x63, 0x9e, 0xd7, 0x75, 0xf6, 0xfb, 0x21, 0xae, 0x1a, 0xab, 0x93, 0x26, 0x3b,
|
||||
0x9e, 0x33, 0x59, 0x6d, 0x5d, 0xba, 0x59, 0x82, 0xb0, 0x38, 0xd2, 0x38, 0x83, 0x51, 0x12, 0x19,
|
||||
0x8c, 0xf6, 0x07, 0x05, 0xce, 0xca, 0x15, 0x15, 0xed, 0xea, 0x84, 0x8e, 0x55, 0x2b, 0x75, 0xac,
|
||||
0x89, 0xa1, 0x63, 0xad, 0xc0, 0x6c, 0xe4, 0xf7, 0x43, 0x0b, 0x1b, 0x34, 0x6b, 0x31, 0x3c, 0x7a,
|
||||
0x4b, 0x73, 0xbf, 0x3b, 0xc3, 0xe1, 0xb7, 0x4d, 0x62, 0xee, 0xf8, 0x36, 0xd6, 0xbe, 0x27, 0xcd,
|
||||
0x2e, 0x65, 0xaf, 0xab, 0x70, 0x96, 0x25, 0x27, 0x66, 0x10, 0x60, 0xcf, 0x36, 0x4c, 0x42, 0x8d,
|
||||
0x5e, 0x61, 0x46, 0x7f, 0x86, 0x4e, 0xdc, 0x64, 0xf0, 0x9b, 0x64, 0x27, 0xd2, 0x7e, 0x3d, 0x0e,
|
||||
0x33, 0x74, 0x2d, 0x75, 0xb2, 0x4a, 0xf2, 0x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 0x47, 0x2d, 0x1d, 0x38, 0xe8, 0x96, 0x6f, 0x0f, 0x58, 0xb8,
|
||||
0x8e, 0x0c, 0x66, 0x64, 0xd6, 0x41, 0xdf, 0x3b, 0x64, 0xbb, 0xa9, 0xeb, 0x4d, 0x27, 0xba, 0x6f,
|
||||
0x46, 0x64, 0x93, 0x82, 0xb4, 0x3f, 0x2a, 0x32, 0x5e, 0xd0, 0x6d, 0xe8, 0xd8, 0xc2, 0xce, 0xd1,
|
||||
0xff, 0x40, 0x1d, 0x74, 0x85, 0x30, 0x82, 0x54, 0xb6, 0x2c, 0x1c, 0x0e, 0xf1, 0x39, 0x71, 0xab,
|
||||
0xb2, 0x99, 0x61, 0xb8, 0x4a, 0x6f, 0x5c, 0x84, 0xab, 0x2f, 0xe4, 0x75, 0x71, 0xc7, 0xda, 0x3d,
|
||||
0x30, 0x43, 0x3b, 0xba, 0x8b, 0x3d, 0x1c, 0x9a, 0xe4, 0x54, 0xd2, 0x17, 0x6d, 0x19, 0x2e, 0x94,
|
||||
0x51, 0x17, 0xfc, 0x3f, 0x97, 0xd7, 0xa0, 0xc4, 0xd0, 0xf1, 0x5e, 0xdf, 0x71, 0xed, 0x53, 0x61,
|
||||
0xff, 0x51, 0x56, 0xb8, 0x98, 0xb8, 0xb0, 0x9f, 0x2b, 0x70, 0x36, 0x64, 0x20, 0x62, 0x44, 0x14,
|
||||
0x21, 0x7e, 0xb1, 0xb6, 0xf5, 0x19, 0x31, 0xc1, 0x16, 0xd2, 0x97, 0xeb, 0xcf, 0xc7, 0xa5, 0x05,
|
||||
0x48, 0x6a, 0xa7, 0x16, 0x56, 0x17, 0xa0, 0x31, 0x64, 0x5f, 0x63, 0xec, 0xeb, 0x91, 0xe0, 0x4b,
|
||||
0xad, 0xd3, 0xf2, 0x83, 0x81, 0x81, 0x2d, 0x9e, 0x51, 0xb0, 0xa3, 0xae, 0xd3, 0x07, 0x5c, 0x30,
|
||||
0xb8, 0x63, 0xb1, 0x84, 0xa2, 0x7a, 0x8c, 0x4d, 0x50, 0xfb, 0x92, 0x53, 0x9b, 0x4a, 0x52, 0xfb,
|
||||
0x92, 0x51, 0x93, 0x38, 0x47, 0x4e, 0x97, 0xe3, 0x4c, 0x0f, 0x71, 0x1e, 0x39, 0x5d, 0x8a, 0x33,
|
||||
0xb4, 0xaa, 0xb4, 0x32, 0xc4, 0xa9, 0x7e, 0x05, 0x0b, 0xe9, 0xd9, 0xea, 0x17, 0xf6, 0x33, 0x29,
|
||||
0x4b, 0xbb, 0x90, 0x35, 0xa7, 0xcc, 0xad, 0x7f, 0x94, 0xdd, 0x76, 0xe5, 0x0c, 0xe7, 0xd9, 0xf6,
|
||||
0xb5, 0x94, 0x55, 0x48, 0x3a, 0x4d, 0xfa, 0x7e, 0x76, 0xdb, 0x27, 0x48, 0x97, 0x8e, 0x67, 0x7c,
|
||||
0x31, 0xeb, 0x02, 0xd9, 0x9c, 0xea, 0x37, 0x71, 0x7c, 0x15, 0x18, 0x34, 0xa3, 0xa9, 0x1c, 0xd7,
|
||||
0x04, 0x5f, 0x51, 0x79, 0x98, 0x16, 0x6c, 0xd1, 0x3c, 0x4c, 0x89, 0xfb, 0x90, 0xbf, 0x58, 0xc4,
|
||||
0x28, 0x55, 0x54, 0xa9, 0x89, 0xa2, 0x8a, 0x2c, 0x16, 0xd1, 0x57, 0xf9, 0x24, 0x0f, 0x8f, 0x74,
|
||||
0xfc, 0x11, 0x1e, 0x68, 0x3b, 0x19, 0x8f, 0xe3, 0x5b, 0x3b, 0xa6, 0x24, 0xc2, 0x6b, 0x0e, 0x36,
|
||||
0x3b, 0x73, 0x5b, 0x94, 0x56, 0x1a, 0x8e, 0x30, 0x02, 0x5b, 0xfb, 0x85, 0x32, 0x24, 0x78, 0xcb,
|
||||
0xf5, 0xf7, 0x4e, 0xd1, 0x2a, 0x93, 0x52, 0xd4, 0x52, 0x52, 0x24, 0xab, 0x46, 0x13, 0xe9, 0xaa,
|
||||
0x51, 0xc2, 0x89, 0x92, 0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, 0x32, 0x28, 0x8c, 0xe4, 0x54, 0x0a, 0xe5, 0xd3, 0x08, 0xdb, 0xda, 0xef, 0x15, 0x68,
|
||||
0x6c, 0xe3, 0x9e, 0xd8, 0xdf, 0x05, 0x80, 0x7d, 0x3f, 0xf4, 0xfb, 0xc4, 0xf1, 0x30, 0x4f, 0xe6,
|
||||
0x27, 0xf5, 0x04, 0xe4, 0x19, 0x76, 0x4b, 0x23, 0x0c, 0x76, 0xbb, 0xe2, 0x4c, 0xd8, 0x37, 0x85,
|
||||
0x1d, 0x60, 0x33, 0x10, 0xc7, 0xc0, 0xbe, 0xe9, 0x93, 0x29, 0x22, 0xa6, 0x75, 0xc8, 0x74, 0x3e,
|
||||
0xa1, 0xf3, 0x81, 0xf6, 0x67, 0x05, 0x40, 0xc7, 0x3d, 0x9f, 0x30, 0x93, 0xa5, 0x72, 0xed, 0x99,
|
||||
0xd6, 0x21, 0x7d, 0x76, 0xb0, 0xd2, 0x29, 0xd7, 0x67, 0x53, 0xc0, 0x58, 0xe9, 0x74, 0x09, 0x40,
|
||||
0xa2, 0x88, 0x30, 0xd8, 0xd0, 0x1b, 0x02, 0xc2, 0x1f, 0x18, 0x32, 0x22, 0x88, 0x6a, 0xe3, 0x30,
|
||||
0x34, 0xf2, 0x6d, 0xcb, 0xd0, 0xb8, 0x00, 0x8d, 0xac, 0x45, 0xb1, 0x88, 0xc2, 0xcc, 0xe9, 0x32,
|
||||
0xb4, 0x65, 0x6d, 0x96, 0xd9, 0xab, 0x10, 0xa5, 0x25, 0x81, 0xd4, 0x46, 0x59, 0x1d, 0xf4, 0x09,
|
||||
0xc1, 0x5e, 0x6c, 0x4a, 0x0d, 0x7d, 0x08, 0xd0, 0xbe, 0x06, 0x90, 0x75, 0x81, 0xae, 0x8f, 0x36,
|
||||
0x60, 0x92, 0x12, 0x97, 0xd5, 0xf6, 0xc5, 0x7c, 0xed, 0x75, 0xa8, 0x06, 0x9d, 0xa3, 0x26, 0xe3,
|
||||
0xd8, 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d, 0xa9, 0x31, 0xf4, 0xb3, 0xe1, 0x8f, 0x31, 0xf2, 0x35, 0x58, 0xb4, 0x51, 0x1a, 0x8a,
|
||||
0x4a, 0x4b, 0xcf, 0xea, 0xeb, 0x27, 0x5a, 0x93, 0x50, 0xfe, 0x2f, 0x15, 0xd9, 0xd9, 0x2d, 0x2c,
|
||||
0x82, 0xa2, 0x37, 0x2a, 0x10, 0xce, 0xd5, 0x71, 0xd5, 0x37, 0x4f, 0xb8, 0xaa, 0xc8, 0x1a, 0x92,
|
||||
0xf5, 0xcf, 0x72, 0x6b, 0x28, 0xa8, 0xa1, 0x96, 0x5b, 0x43, 0x51, 0x49, 0x55, 0x1b, 0x43, 0xf7,
|
||||
0x61, 0x92, 0x3d, 0xd7, 0xd1, 0x85, 0xe3, 0xdf, 0xf1, 0xea, 0xc5, 0xe2, 0xf9, 0xf8, 0x35, 0x4a,
|
||||
0x05, 0xd8, 0x9b, 0x62, 0xff, 0x35, 0x78, 0xfd, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x46, 0xc8,
|
||||
0xe1, 0xbc, 0x82, 0x30, 0x00, 0x00,
|
||||
// 3329 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xd4, 0x3b, 0x4b, 0x6f, 0x1c, 0xc7,
|
||||
0xd1, 0x5c, 0x2e, 0x1f, 0xbb, 0xb5, 0xbb, 0x22, 0xd5, 0x94, 0xa9, 0xf5, 0x90, 0x92, 0xa8, 0x91,
|
||||
0x1f, 0x92, 0x6c, 0x51, 0x32, 0x6d, 0x7f, 0x96, 0xe5, 0xcf, 0xfe, 0x2c, 0x51, 0xa2, 0x2c, 0x5b,
|
||||
0xa4, 0xec, 0xa1, 0x2c, 0x7f, 0x89, 0x8c, 0x0c, 0x86, 0x33, 0xbd, 0xe4, 0x98, 0xb3, 0xd3, 0xa3,
|
||||
0x99, 0x5e, 0x5a, 0x2b, 0x38, 0x27, 0x07, 0x48, 0x80, 0x20, 0x39, 0x04, 0xb9, 0xe4, 0x12, 0x20,
|
||||
0xc8, 0x3d, 0xd7, 0xfc, 0x05, 0xff, 0x81, 0x00, 0x39, 0xe5, 0x92, 0x73, 0x0e, 0x39, 0x04, 0x08,
|
||||
0x90, 0x4b, 0xd0, 0xaf, 0xd9, 0x79, 0x72, 0x87, 0x11, 0x83, 0x20, 0xb7, 0xe9, 0xea, 0xea, 0xaa,
|
||||
0xae, 0xea, 0xaa, 0xea, 0xea, 0xaa, 0x5d, 0x58, 0x38, 0x20, 0xde, 0xa0, 0x8f, 0xcd, 0x08, 0x87,
|
||||
0x07, 0x38, 0x5c, 0x0d, 0x42, 0x42, 0x09, 0x9a, 0x4f, 0x01, 0xcd, 0x60, 0x47, 0x7f, 0x0c, 0xe8,
|
||||
0x96, 0x45, 0xed, 0xbd, 0xdb, 0xd8, 0xc3, 0x14, 0x1b, 0xf8, 0xc9, 0x00, 0x47, 0x14, 0xbd, 0x08,
|
||||
0x8d, 0x9e, 0xeb, 0x61, 0xd3, 0x75, 0xa2, 0x6e, 0x6d, 0xa5, 0x7e, 0xb1, 0x69, 0xcc, 0xb2, 0xf1,
|
||||
0x3d, 0x27, 0x42, 0x97, 0xe1, 0x64, 0xb4, 0xef, 0x06, 0xa6, 0x4d, 0xc8, 0xbe, 0x8b, 0x4d, 0x7b,
|
||||
0x0f, 0xdb, 0xfb, 0xdd, 0xc9, 0x95, 0xda, 0xc5, 0x86, 0x31, 0xc7, 0x26, 0xd6, 0x39, 0x7c, 0x9d,
|
||||
0x81, 0xf5, 0x07, 0xb0, 0x90, 0x22, 0x1e, 0x05, 0xc4, 0x8f, 0x30, 0xba, 0x0e, 0xb3, 0x21, 0x8e,
|
||||
0x06, 0x1e, 0x15, 0xc4, 0x5b, 0x6b, 0x67, 0x57, 0xb3, 0xfb, 0x5a, 0x8d, 0x97, 0x0c, 0x3c, 0x6a,
|
||||
0x28, 0x74, 0xfd, 0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0x1b, 0x93, 0x17,
|
||||
0x80, 0xbc, 0x52, 0x5a, 0x0c, 0xb6, 0x2e, 0x40, 0xfa, 0x1b, 0x80, 0x04, 0x8d, 0x4d, 0x32, 0xf0,
|
||||
0xab, 0x39, 0xfc, 0x0b, 0xb0, 0x90, 0x5a, 0x22, 0x6d, 0xe3, 0x4d, 0x38, 0x25, 0xc0, 0x9f, 0xfb,
|
||||
0xfd, 0xca, 0xb4, 0x4e, 0xc3, 0x0b, 0x99, 0x45, 0x92, 0xda, 0x9a, 0x62, 0x92, 0x4e, 0x4d, 0x0e,
|
||||
0x25, 0xb6, 0xa8, 0x76, 0x90, 0xce, 0x38, 0x78, 0x6c, 0x13, 0x1b, 0xb6, 0xc2, 0x7d, 0x16, 0x77,
|
||||
0x58, 0x24, 0xaa, 0x44, 0x71, 0x19, 0xb4, 0xa2, 0x95, 0x92, 0xee, 0x17, 0xb0, 0xa8, 0x62, 0x9e,
|
||||
0xdf, 0x73, 0x77, 0x07, 0x21, 0xae, 0x1a, 0xab, 0x93, 0x26, 0x3b, 0x99, 0x33, 0x59, 0xfd, 0xaa,
|
||||
0x72, 0xb3, 0x04, 0x61, 0x79, 0xa4, 0x71, 0x06, 0x53, 0x4b, 0x64, 0x30, 0xfa, 0xef, 0x6a, 0x70,
|
||||
0x52, 0xad, 0xa8, 0x68, 0x57, 0x47, 0x74, 0xac, 0x7a, 0xa9, 0x63, 0x4d, 0x8d, 0x1c, 0xeb, 0x22,
|
||||
0xcc, 0x47, 0x64, 0x10, 0xda, 0xd8, 0x64, 0x59, 0x8b, 0xe9, 0xb3, 0x5b, 0x5a, 0xf8, 0xdd, 0x09,
|
||||
0x01, 0xbf, 0x6d, 0x51, 0x6b, 0x8b, 0x38, 0x58, 0xff, 0x3f, 0x65, 0x76, 0x29, 0x7b, 0xbd, 0x04,
|
||||
0x27, 0x79, 0x72, 0x62, 0x05, 0x01, 0xf6, 0x1d, 0xd3, 0xa2, 0xcc, 0xe8, 0x6b, 0xdc, 0xe8, 0x4f,
|
||||
0xb0, 0x89, 0x9b, 0x1c, 0x7e, 0x93, 0x6e, 0x45, 0xfa, 0x2f, 0x27, 0x61, 0x8e, 0xad, 0x65, 0x4e,
|
||||
0x56, 0x49, 0xde, 0x79, 0xa8, 0xe3, 0xa7, 0x54, 0x0a, 0xca, 0x3e, 0xd1, 0x55, 0x58, 0x90, 0xde,
|
||||
0xec, 0x12, 0x7f, 0xe4, 0xe8, 0x75, 0x11, 0x17, 0x47, 0x53, 0xb1, 0xaf, 0x9f, 0x83, 0x56, 0x44,
|
||||
0x49, 0xa0, 0xe2, 0x86, 0xc8, 0x9c, 0x80, 0x81, 0x64, 0xdc, 0x48, 0xeb, 0x74, 0xba, 0x40, 0xa7,
|
||||
0xec, 0x32, 0xc4, 0xb6, 0x29, 0x76, 0xc5, 0x23, 0x0f, 0xbf, 0x0c, 0xef, 0xd8, 0x42, 0x1b, 0xe8,
|
||||
0x03, 0x58, 0x76, 0x77, 0x7d, 0x12, 0x62, 0x53, 0x2a, 0x92, 0xfb, 0xaf, 0x4f, 0xa8, 0xd9, 0x23,
|
||||
0x03, 0x5f, 0xe5, 0x56, 0x5d, 0x81, 0xb3, 0xcd, 0x51, 0x98, 0x06, 0xb6, 0x08, 0xdd, 0x60, 0xf3,
|
||||
0xfa, 0xdb, 0x30, 0x3f, 0xd2, 0x4a, 0xf5, 0x28, 0xf0, 0x6d, 0x4d, 0x59, 0xdc, 0x43, 0xcb, 0xf5,
|
||||
0xb6, 0xb1, 0xef, 0xe0, 0xf0, 0x39, 0xa3, 0x13, 0xba, 0x06, 0xa7, 0x5c, 0xc7, 0xc3, 0x26, 0x75,
|
||||
0xfb, 0x98, 0x0c, 0xa8, 0x19, 0x61, 0x9b, 0xf8, 0x4e, 0xa4, 0xf4, 0xcb, 0xe6, 0x1e, 0x8a, 0xa9,
|
||||
0x6d, 0x31, 0xa3, 0xff, 0x28, 0xbe, 0x25, 0x92, 0xbb, 0x18, 0x65, 0x50, 0x3e, 0xc6, 0x8c, 0xa0,
|
||||
0x48, 0x06, 0xa5, 0x18, 0x6d, 0x01, 0x14, 0x79, 0x1f, 0x3b, 0x21, 0x89, 0xb4, 0x43, 0x9c, 0x21,
|
||||
0xdf, 0x51, 0xdb, 0x00, 0x01, 0xba, 0x45, 0x9c, 0x21, 0x0f, 0xd7, 0x91, 0xc9, 0x8d, 0xcc, 0xde,
|
||||
0x1b, 0xf8, 0xfb, 0x7c, 0x37, 0x0d, 0xa3, 0xe5, 0x46, 0xf7, 0xad, 0x88, 0xae, 0x33, 0x90, 0xfe,
|
||||
0xfb, 0x9a, 0x8a, 0x17, 0x6c, 0x1b, 0x06, 0xb6, 0xb1, 0x7b, 0xf0, 0x1f, 0x50, 0x07, 0x5b, 0x21,
|
||||
0x8d, 0x20, 0x95, 0x2d, 0x4b, 0x87, 0x43, 0x62, 0x4e, 0xde, 0xaa, 0x7c, 0x66, 0x14, 0xae, 0xd2,
|
||||
0x1b, 0x97, 0xe1, 0xea, 0x4b, 0x75, 0x5d, 0xdc, 0xb1, 0xb7, 0xf7, 0xac, 0xd0, 0x89, 0xee, 0x62,
|
||||
0x1f, 0x87, 0x16, 0x3d, 0x96, 0xf4, 0x45, 0x5f, 0x81, 0xb3, 0x65, 0xd4, 0x25, 0xff, 0xc7, 0xea,
|
||||
0x1a, 0x54, 0x18, 0x06, 0xde, 0x19, 0xb8, 0x9e, 0x73, 0x2c, 0xec, 0x3f, 0xc9, 0x0a, 0x17, 0x13,
|
||||
0x97, 0xf6, 0x73, 0x19, 0x4e, 0x86, 0x1c, 0x44, 0xcd, 0x88, 0x21, 0xc4, 0xaf, 0xdb, 0x8e, 0x31,
|
||||
0x27, 0x27, 0xf8, 0xc2, 0x7b, 0x4e, 0xa4, 0xff, 0x74, 0x52, 0x59, 0x80, 0xa2, 0x76, 0x6c, 0x61,
|
||||
0x75, 0x09, 0x9a, 0x23, 0xf6, 0x75, 0xce, 0xbe, 0x11, 0x49, 0xbe, 0xcc, 0x3a, 0x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|
||||
0xec, 0x09, 0xcc, 0xba, 0xa2, 0x89, 0xbd, 0x04, 0xe2, 0x25, 0x98, 0x7f, 0x32, 0x60, 0x81, 0xcf,
|
||||
0xde, 0xb3, 0x42, 0xcb, 0xa6, 0x24, 0xae, 0xaa, 0xcc, 0x71, 0xf8, 0x7a, 0x0c, 0x46, 0x6f, 0xc1,
|
||||
0xa2, 0x40, 0xc5, 0x91, 0x6d, 0x05, 0xf1, 0x0a, 0x1c, 0xca, 0x47, 0xf7, 0x29, 0x3e, 0x7b, 0x87,
|
||||
0x4f, 0xae, 0xab, 0x39, 0xa4, 0x41, 0xc3, 0x26, 0xfd, 0x3e, 0xf6, 0x69, 0x24, 0x1b, 0xa5, 0xf1,
|
||||
0x18, 0xdd, 0x84, 0x33, 0x96, 0xe7, 0x91, 0xaf, 0x4d, 0xbe, 0xd2, 0x31, 0x73, 0xd2, 0x89, 0x27,
|
||||
0xb8, 0xc6, 0x91, 0x3e, 0xe3, 0x38, 0x46, 0x5a, 0x50, 0xed, 0x1c, 0x34, 0xe3, 0x73, 0x64, 0x29,
|
||||
0x4f, 0xc2, 0x20, 0xf9, 0xb7, 0x76, 0x02, 0xda, 0xc9, 0x93, 0xd0, 0xfe, 0x5a, 0x87, 0x85, 0x02,
|
||||
0xa7, 0x42, 0x8f, 0x01, 0x98, 0xb5, 0x0a, 0xd7, 0x92, 0xe6, 0xfa, 0xbf, 0x47, 0x77, 0x4e, 0x66,
|
||||
0xaf, 0x02, 0x6c, 0x30, 0xeb, 0x17, 0x9f, 0xe8, 0x07, 0xd0, 0xe2, 0x16, 0x2b, 0xa9, 0x0b, 0x93,
|
||||
0x7d, 0xff, 0x5f, 0xa0, 0xce, 0x64, 0x95, 0xe4, 0xb9, 0x0f, 0x88, 0x6f, 0xed, 0xcf, 0x35, 0x68,
|
||||
0xc6, 0x8c, 0x59, 0x02, 0x27, 0x0e, 0x8a, 0x9f, 0x75, 0xa4, 0x12, 0x38, 0x0e, 0xdb, 0xe0, 0x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d9, 0x53, 0x41, 0x63, 0xaa, 0xc0,
|
||||
0x7b, 0x55, 0xf3, 0x68, 0xbc, 0xf7, 0x66, 0x9a, 0x58, 0xe3, 0xbd, 0x37, 0xd7, 0x97, 0x9a, 0x40,
|
||||
0x3f, 0x19, 0xfd, 0x18, 0x23, 0x5f, 0x83, 0x45, 0x6b, 0xa5, 0xa1, 0xa8, 0xb4, 0xf4, 0xac, 0xbd,
|
||||
0x79, 0xa4, 0x35, 0x09, 0xe5, 0xff, 0xbc, 0xa6, 0x3a, 0xbb, 0x85, 0x45, 0x50, 0xf4, 0x56, 0x05,
|
||||
0xc2, 0xb9, 0x3a, 0xae, 0xf6, 0xf6, 0x11, 0x57, 0x15, 0x59, 0x43, 0xb2, 0xfe, 0x59, 0x6e, 0x0d,
|
||||
0x05, 0x35, 0xd4, 0x72, 0x6b, 0x28, 0x2a, 0xa9, 0xea, 0x13, 0xe8, 0x3e, 0x4c, 0xf3, 0xe7, 0x3a,
|
||||
0x3a, 0x7b, 0xf8, 0x3b, 0x5e, 0x3b, 0x57, 0x3c, 0x1f, 0xbf, 0x46, 0x99, 0x00, 0x3b, 0x33, 0xfc,
|
||||
0x7f, 0x09, 0x6f, 0xfe, 0x33, 0x00, 0x00, 0xff, 0xff, 0x4d, 0x3e, 0xd5, 0xcd, 0xae, 0x30, 0x00,
|
||||
0x00,
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package queue
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
type dataToFlush struct {
|
||||
startTime time.Time
|
||||
stopTime time.Time
|
||||
data []byte
|
||||
}
|
||||
|
||||
type LogBuffer struct {
|
||||
buf []byte
|
||||
idx []int
|
||||
pos int
|
||||
startTime time.Time
|
||||
stopTime time.Time
|
||||
sizeBuf []byte
|
||||
flushInterval time.Duration
|
||||
flushFn func(startTime, stopTime time.Time, buf []byte)
|
||||
notifyFn func()
|
||||
isStopping bool
|
||||
flushChan chan *dataToFlush
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
func NewLogBuffer(flushInterval time.Duration, flushFn func(startTime, stopTime time.Time, buf []byte), notifyFn func()) *LogBuffer {
|
||||
lb := &LogBuffer{
|
||||
buf: make([]byte, 4*1024*1024),
|
||||
sizeBuf: make([]byte, 4),
|
||||
flushInterval: flushInterval,
|
||||
flushFn: flushFn,
|
||||
notifyFn: notifyFn,
|
||||
flushChan: make(chan *dataToFlush, 256),
|
||||
}
|
||||
go lb.loopFlush()
|
||||
go lb.loopInterval()
|
||||
return lb
|
||||
}
|
||||
|
||||
func (m *LogBuffer) AddToBuffer(ts time.Time, key, data []byte) {
|
||||
|
||||
logEntry := &filer_pb.LogEntry{
|
||||
TsNs: ts.UnixNano(),
|
||||
PartitionKeyHash: util.HashToInt32(key),
|
||||
Data: data,
|
||||
}
|
||||
|
||||
logEntryData, _ := proto.Marshal(logEntry)
|
||||
|
||||
size := len(logEntryData)
|
||||
|
||||
m.Lock()
|
||||
defer func() {
|
||||
m.Unlock()
|
||||
if m.notifyFn != nil {
|
||||
m.notifyFn()
|
||||
}
|
||||
}()
|
||||
|
||||
if m.pos == 0 {
|
||||
m.startTime = ts
|
||||
}
|
||||
|
||||
if m.startTime.Add(m.flushInterval).Before(ts) || len(m.buf)-m.pos < size+4 {
|
||||
m.flushChan <- m.copyToFlush()
|
||||
m.startTime = ts
|
||||
if len(m.buf) < size+4 {
|
||||
m.buf = make([]byte, 2*size+4)
|
||||
}
|
||||
}
|
||||
m.stopTime = ts
|
||||
|
||||
m.idx = append(m.idx, m.pos)
|
||||
util.Uint32toBytes(m.sizeBuf, uint32(size))
|
||||
copy(m.buf[m.pos:m.pos+4], m.sizeBuf)
|
||||
copy(m.buf[m.pos+4:m.pos+4+size], logEntryData)
|
||||
m.pos += size + 4
|
||||
}
|
||||
|
||||
func (m *LogBuffer) Shutdown() {
|
||||
if m.isStopping {
|
||||
return
|
||||
}
|
||||
m.isStopping = true
|
||||
m.Lock()
|
||||
toFlush := m.copyToFlush()
|
||||
m.Unlock()
|
||||
m.flushChan <- toFlush
|
||||
close(m.flushChan)
|
||||
}
|
||||
|
||||
func (m *LogBuffer) loopFlush() {
|
||||
for d := range m.flushChan {
|
||||
if d != nil {
|
||||
m.flushFn(d.startTime, d.stopTime, d.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m *LogBuffer) loopInterval() {
|
||||
for !m.isStopping {
|
||||
m.Lock()
|
||||
toFlush := m.copyToFlush()
|
||||
m.Unlock()
|
||||
m.flushChan <- toFlush
|
||||
time.Sleep(m.flushInterval)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *LogBuffer) copyToFlush() *dataToFlush {
|
||||
|
||||
if m.flushFn != nil && m.pos > 0 {
|
||||
// fmt.Printf("flush buffer %d pos %d empty space %d\n", len(m.buf), m.pos, len(m.buf)-m.pos)
|
||||
d := &dataToFlush{
|
||||
startTime: m.startTime,
|
||||
stopTime: m.stopTime,
|
||||
data: copiedBytes(m.buf[:m.pos]),
|
||||
}
|
||||
m.pos = 0
|
||||
m.idx = m.idx[:0]
|
||||
return d
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LogBuffer) ReadFromBuffer(lastReadTime time.Time) (ts time.Time, bufferCopy []byte) {
|
||||
m.RLock()
|
||||
defer m.RUnlock()
|
||||
|
||||
// fmt.Printf("read from buffer: %v\n", lastReadTime)
|
||||
|
||||
if lastReadTime.Equal(m.stopTime) {
|
||||
return lastReadTime, nil
|
||||
}
|
||||
if lastReadTime.After(m.stopTime) {
|
||||
// glog.Fatalf("unexpected last read time %v, older than latest %v", lastReadTime, m.stopTime)
|
||||
return lastReadTime, nil
|
||||
}
|
||||
if lastReadTime.Before(m.startTime) {
|
||||
return m.stopTime, copiedBytes(m.buf[:m.pos])
|
||||
}
|
||||
|
||||
lastTs := lastReadTime.UnixNano()
|
||||
l, h := 0, len(m.idx)-1
|
||||
|
||||
/*
|
||||
for i, pos := range m.idx {
|
||||
logEntry, ts := readTs(m.buf, pos)
|
||||
event := &filer_pb.FullEventNotification{}
|
||||
proto.Unmarshal(logEntry.Data, event)
|
||||
entry := event.EventNotification.OldEntry
|
||||
if entry == nil {
|
||||
entry = event.EventNotification.NewEntry
|
||||
}
|
||||
fmt.Printf("entry %d ts: %v offset:%d dir:%s name:%s\n", i, time.Unix(0, ts), pos, event.Directory, entry.Name)
|
||||
}
|
||||
fmt.Printf("l=%d, h=%d\n", l, h)
|
||||
*/
|
||||
|
||||
for l <= h {
|
||||
mid := (l + h) / 2
|
||||
pos := m.idx[mid]
|
||||
_, t := readTs(m.buf, m.idx[mid])
|
||||
if t <= lastTs {
|
||||
l = mid + 1
|
||||
} else if lastTs < t {
|
||||
var prevT int64
|
||||
if mid > 0 {
|
||||
_, prevT = readTs(m.buf, m.idx[mid-1])
|
||||
}
|
||||
if prevT <= lastTs {
|
||||
// println("found mid = ", mid)
|
||||
return time.Unix(0, t), copiedBytes(m.buf[pos:m.pos])
|
||||
}
|
||||
h = mid - 1
|
||||
}
|
||||
// fmt.Printf("l=%d, h=%d\n", l, h)
|
||||
}
|
||||
|
||||
// FIXME: this could be that the buffer has been flushed already
|
||||
// println("not found")
|
||||
return lastReadTime, nil
|
||||
|
||||
}
|
||||
func copiedBytes(buf []byte) (copied []byte) {
|
||||
copied = make([]byte, len(buf))
|
||||
copy(copied, buf)
|
||||
return
|
||||
}
|
||||
|
||||
func readTs(buf []byte, pos int) (*filer_pb.LogEntry, int64) {
|
||||
|
||||
size := util.BytesToUint32(buf[pos : pos+4])
|
||||
entryData := buf[pos+4 : pos+4+int(size)]
|
||||
logEntry := &filer_pb.LogEntry{}
|
||||
|
||||
err := proto.Unmarshal(entryData, logEntry)
|
||||
if err != nil {
|
||||
glog.Fatalf("unexpected unmarshal filer_pb.LogEntry: %v", err)
|
||||
}
|
||||
return logEntry, logEntry.TsNs
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package replication
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
@@ -36,7 +35,7 @@ func (r *Replicator) Replicate(ctx context.Context, key string, message *filer_p
|
||||
glog.V(4).Infof("skipping %v outside of %v", key, r.source.Dir)
|
||||
return nil
|
||||
}
|
||||
newKey := filepath.ToSlash(filepath.Join(r.sink.GetSinkToDirectory(), key[len(r.source.Dir):]))
|
||||
newKey := util.Join(r.sink.GetSinkToDirectory(), key[len(r.source.Dir):])
|
||||
glog.V(3).Infof("replicate %s => %s", key, newKey)
|
||||
key = newKey
|
||||
if message.OldEntry != nil && message.NewEntry == nil {
|
||||
|
||||
@@ -96,7 +96,7 @@ func (g *AzureSink) CreateEntry(key string, entry *filer_pb.Entry) error {
|
||||
}
|
||||
|
||||
totalSize := filer2.TotalSize(entry.Chunks)
|
||||
chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int(totalSize))
|
||||
chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int64(totalSize))
|
||||
|
||||
// Create a URL that references a to-be-created blob in your
|
||||
// Azure Storage account's container.
|
||||
|
||||
@@ -85,7 +85,7 @@ func (g *B2Sink) CreateEntry(key string, entry *filer_pb.Entry) error {
|
||||
}
|
||||
|
||||
totalSize := filer2.TotalSize(entry.Chunks)
|
||||
chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int(totalSize))
|
||||
chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int64(totalSize))
|
||||
|
||||
bucket, err := g.client.Bucket(context.Background(), g.bucket)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,7 +3,6 @@ package filersink
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
@@ -69,7 +68,7 @@ func (fs *FilerSink) fetchAndWrite(sourceChunk *filer_pb.FileChunk, dir string)
|
||||
var host string
|
||||
var auth security.EncodedJwt
|
||||
|
||||
if err := fs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
if err := fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.AssignVolumeRequest{
|
||||
Count: 1,
|
||||
@@ -101,7 +100,7 @@ func (fs *FilerSink) fetchAndWrite(sourceChunk *filer_pb.FileChunk, dir string)
|
||||
glog.V(4).Infof("replicating %s to %s header:%+v", filename, fileUrl, header)
|
||||
|
||||
// fetch data as is, regardless whether it is encrypted or not
|
||||
uploadResult, err := operation.Upload(fileUrl, filename, false, readCloser, "gzip" == header.Get("Content-Encoding"), header.Get("Content-Type"), nil, auth)
|
||||
uploadResult, err, _ := operation.Upload(fileUrl, filename, false, readCloser, "gzip" == header.Get("Content-Encoding"), header.Get("Content-Type"), nil, auth)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("upload data %v to %s: %v", filename, fileUrl, err)
|
||||
return "", fmt.Errorf("upload data: %v", err)
|
||||
@@ -114,7 +113,7 @@ func (fs *FilerSink) fetchAndWrite(sourceChunk *filer_pb.FileChunk, dir string)
|
||||
return
|
||||
}
|
||||
|
||||
func (fs *FilerSink) withFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {
|
||||
func (fs *FilerSink) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {
|
||||
|
||||
return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
|
||||
client := filer_pb.NewSeaweedFilerClient(grpcConnection)
|
||||
@@ -122,11 +121,6 @@ func (fs *FilerSink) withFilerClient(fn func(filer_pb.SeaweedFilerClient) error)
|
||||
}, fs.grpcAddress, fs.grpcDialOption)
|
||||
|
||||
}
|
||||
|
||||
func volumeId(fileId string) string {
|
||||
lastCommaIndex := strings.LastIndex(fileId, ",")
|
||||
if lastCommaIndex > 0 {
|
||||
return fileId[:lastCommaIndex]
|
||||
}
|
||||
return fileId
|
||||
func (fs *FilerSink) AdjustedUrl(hostAndPort string) string {
|
||||
return hostAndPort
|
||||
}
|
||||
@@ -65,32 +65,23 @@ func (fs *FilerSink) initialize(grpcAddress string, dir string,
|
||||
}
|
||||
|
||||
func (fs *FilerSink) DeleteEntry(key string, isDirectory, deleteIncludeChunks bool) error {
|
||||
return fs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
dir, name := filer2.FullPath(key).DirAndName()
|
||||
dir, name := util.FullPath(key).DirAndName()
|
||||
|
||||
request := &filer_pb.DeleteEntryRequest{
|
||||
Directory: dir,
|
||||
Name: name,
|
||||
IsDeleteData: deleteIncludeChunks,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("delete entry: %v", request)
|
||||
_, err := client.DeleteEntry(context.Background(), request)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("delete entry %s: %v", key, err)
|
||||
return fmt.Errorf("delete entry %s: %v", key, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
glog.V(1).Infof("delete entry: %v", key)
|
||||
err := filer_pb.Remove(fs, dir, name, deleteIncludeChunks, false, false)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("delete entry %s: %v", key, err)
|
||||
return fmt.Errorf("delete entry %s: %v", key, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fs *FilerSink) CreateEntry(key string, entry *filer_pb.Entry) error {
|
||||
|
||||
return fs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
return fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
dir, name := filer2.FullPath(key).DirAndName()
|
||||
dir, name := util.FullPath(key).DirAndName()
|
||||
|
||||
// look up existing entry
|
||||
lookupRequest := &filer_pb.LookupDirectoryEntryRequest{
|
||||
@@ -136,11 +127,11 @@ func (fs *FilerSink) CreateEntry(key string, entry *filer_pb.Entry) error {
|
||||
|
||||
func (fs *FilerSink) UpdateEntry(key string, oldEntry *filer_pb.Entry, newParentPath string, newEntry *filer_pb.Entry, deleteIncludeChunks bool) (foundExistingEntry bool, err error) {
|
||||
|
||||
dir, name := filer2.FullPath(key).DirAndName()
|
||||
dir, name := util.FullPath(key).DirAndName()
|
||||
|
||||
// read existing entry
|
||||
var existingEntry *filer_pb.Entry
|
||||
err = fs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
err = fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.LookupDirectoryEntryRequest{
|
||||
Directory: dir,
|
||||
@@ -192,7 +183,7 @@ func (fs *FilerSink) UpdateEntry(key string, oldEntry *filer_pb.Entry, newParent
|
||||
}
|
||||
|
||||
// save updated meta data
|
||||
return true, fs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
return true, fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.UpdateEntryRequest{
|
||||
Directory: newParentPath,
|
||||
|
||||
@@ -90,7 +90,7 @@ func (g *GcsSink) CreateEntry(key string, entry *filer_pb.Entry) error {
|
||||
}
|
||||
|
||||
totalSize := filer2.TotalSize(entry.Chunks)
|
||||
chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int(totalSize))
|
||||
chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int64(totalSize))
|
||||
|
||||
wc := g.client.Bucket(g.bucket).Object(key).NewWriter(context.Background())
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ func (s3sink *S3Sink) CreateEntry(key string, entry *filer_pb.Entry) error {
|
||||
}
|
||||
|
||||
totalSize := filer2.TotalSize(entry.Chunks)
|
||||
chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int(totalSize))
|
||||
chunkViews := filer2.ViewFromChunks(entry.Chunks, 0, int64(totalSize))
|
||||
|
||||
parts := make([]*s3.CompletedPart, len(chunkViews))
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ func (s3a *S3ApiServer) completeMultipartUpload(input *s3.CompleteMultipartUploa
|
||||
},
|
||||
}
|
||||
|
||||
if err = s3a.rm(s3a.genUploadsFolder(*input.Bucket), *input.UploadId, true, false, true); err != nil {
|
||||
if err = s3a.rm(s3a.genUploadsFolder(*input.Bucket), *input.UploadId, false, true); err != nil {
|
||||
glog.V(1).Infof("completeMultipartUpload cleanup %s upload %s: %v", *input.Bucket, *input.UploadId, err)
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ func (s3a *S3ApiServer) abortMultipartUpload(input *s3.AbortMultipartUploadInput
|
||||
return nil, ErrNoSuchUpload
|
||||
}
|
||||
if exists {
|
||||
err = s3a.rm(s3a.genUploadsFolder(*input.Bucket), *input.UploadId, true, true, true)
|
||||
err = s3a.rm(s3a.genUploadsFolder(*input.Bucket), *input.UploadId, true, true)
|
||||
}
|
||||
if err != nil {
|
||||
glog.V(1).Infof("bucket %s remove upload %s: %v", *input.Bucket, *input.UploadId, err)
|
||||
@@ -155,7 +155,7 @@ func (s3a *S3ApiServer) listMultipartUploads(input *s3.ListMultipartUploadsInput
|
||||
},
|
||||
}
|
||||
|
||||
entries, err := s3a.list(s3a.genUploadsFolder(*input.Bucket), *input.Prefix, *input.KeyMarker, true, int(*input.MaxUploads))
|
||||
entries, err := s3a.list(s3a.genUploadsFolder(*input.Bucket), *input.Prefix, *input.KeyMarker, true, uint32(*input.MaxUploads))
|
||||
if err != nil {
|
||||
glog.Errorf("listMultipartUploads %s error: %v", *input.Bucket, err)
|
||||
return
|
||||
@@ -190,7 +190,7 @@ func (s3a *S3ApiServer) listObjectParts(input *s3.ListPartsInput) (output *ListP
|
||||
},
|
||||
}
|
||||
|
||||
entries, err := s3a.list(s3a.genUploadsFolder(*input.Bucket)+"/"+*input.UploadId, "", fmt.Sprintf("%04d.part", *input.PartNumberMarker), false, int(*input.MaxParts))
|
||||
entries, err := s3a.list(s3a.genUploadsFolder(*input.Bucket)+"/"+*input.UploadId, "", fmt.Sprintf("%04d.part", *input.PartNumberMarker), false, uint32(*input.MaxParts))
|
||||
if err != nil {
|
||||
glog.Errorf("listObjectParts %s %s error: %v", *input.Bucket, *input.UploadId, err)
|
||||
return nil, ErrNoSuchUpload
|
||||
|
||||
+28
-177
@@ -3,135 +3,41 @@ package s3api
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
)
|
||||
|
||||
func (s3a *S3ApiServer) mkdir(parentDirectoryPath string, dirName string, fn func(entry *filer_pb.Entry)) error {
|
||||
return s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
entry := &filer_pb.Entry{
|
||||
Name: dirName,
|
||||
IsDirectory: true,
|
||||
Attributes: &filer_pb.FuseAttributes{
|
||||
Mtime: time.Now().Unix(),
|
||||
Crtime: time.Now().Unix(),
|
||||
FileMode: uint32(0777 | os.ModeDir),
|
||||
Uid: OS_UID,
|
||||
Gid: OS_GID,
|
||||
},
|
||||
}
|
||||
return filer_pb.Mkdir(s3a, parentDirectoryPath, dirName, fn)
|
||||
|
||||
if fn != nil {
|
||||
fn(entry)
|
||||
}
|
||||
|
||||
request := &filer_pb.CreateEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Entry: entry,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("mkdir: %v", request)
|
||||
if err := filer_pb.CreateEntry(client, request); err != nil {
|
||||
glog.V(0).Infof("mkdir %v: %v", request, err)
|
||||
return fmt.Errorf("mkdir %s/%s: %v", parentDirectoryPath, dirName, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) mkFile(parentDirectoryPath string, fileName string, chunks []*filer_pb.FileChunk) error {
|
||||
return s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
entry := &filer_pb.Entry{
|
||||
Name: fileName,
|
||||
IsDirectory: false,
|
||||
Attributes: &filer_pb.FuseAttributes{
|
||||
Mtime: time.Now().Unix(),
|
||||
Crtime: time.Now().Unix(),
|
||||
FileMode: uint32(0770),
|
||||
Uid: OS_UID,
|
||||
Gid: OS_GID,
|
||||
},
|
||||
Chunks: chunks,
|
||||
}
|
||||
return filer_pb.MkFile(s3a, parentDirectoryPath, fileName, chunks)
|
||||
|
||||
request := &filer_pb.CreateEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Entry: entry,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("create file: %s/%s", parentDirectoryPath, fileName)
|
||||
if err := filer_pb.CreateEntry(client, request); err != nil {
|
||||
glog.V(0).Infof("create file %v:%v", request, err)
|
||||
return fmt.Errorf("create file %s/%s: %v", parentDirectoryPath, fileName, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) list(parentDirectoryPath, prefix, startFrom string, inclusive bool, limit int) (entries []*filer_pb.Entry, err error) {
|
||||
func (s3a *S3ApiServer) list(parentDirectoryPath, prefix, startFrom string, inclusive bool, limit uint32) (entries []*filer_pb.Entry, err error) {
|
||||
|
||||
err = s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.ListEntriesRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Prefix: prefix,
|
||||
StartFromFileName: startFrom,
|
||||
InclusiveStartFrom: inclusive,
|
||||
Limit: uint32(limit),
|
||||
}
|
||||
|
||||
glog.V(4).Infof("read directory: %v", request)
|
||||
stream, err := client.ListEntries(context.Background(), request)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("read directory %v: %v", request, err)
|
||||
return fmt.Errorf("list dir %v: %v", parentDirectoryPath, err)
|
||||
}
|
||||
|
||||
for {
|
||||
resp, recvErr := stream.Recv()
|
||||
if recvErr != nil {
|
||||
if recvErr == io.EOF {
|
||||
break
|
||||
} else {
|
||||
return recvErr
|
||||
}
|
||||
}
|
||||
|
||||
entries = append(entries, resp.Entry)
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
err = filer_pb.List(s3a, parentDirectoryPath, prefix, func(entry *filer_pb.Entry, isLast bool) {
|
||||
entries = append(entries, entry)
|
||||
}, startFrom, inclusive, limit)
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) rm(parentDirectoryPath, entryName string, isDirectory, isDeleteData, isRecursive bool) error {
|
||||
func (s3a *S3ApiServer) rm(parentDirectoryPath, entryName string, isDeleteData, isRecursive bool) error {
|
||||
|
||||
return s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
return s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.DeleteEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Name: entryName,
|
||||
IsDeleteData: isDeleteData,
|
||||
IsRecursive: isRecursive,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("delete entry %v/%v: %v", parentDirectoryPath, entryName, request)
|
||||
if _, err := client.DeleteEntry(context.Background(), request); err != nil {
|
||||
glog.V(0).Infof("delete entry %v: %v", request, err)
|
||||
return fmt.Errorf("delete entry %s/%s: %v", parentDirectoryPath, entryName, err)
|
||||
err := doDeleteEntry(client, parentDirectoryPath, entryName, isDeleteData, isRecursive)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -139,85 +45,30 @@ func (s3a *S3ApiServer) rm(parentDirectoryPath, entryName string, isDirectory, i
|
||||
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) streamRemove(quiet bool, fn func() (finished bool, parentDirectoryPath string, entryName string, isDeleteData, isRecursive bool), respFn func(err string)) error {
|
||||
func doDeleteEntry(client filer_pb.SeaweedFilerClient, parentDirectoryPath string, entryName string, isDeleteData bool, isRecursive bool) error {
|
||||
request := &filer_pb.DeleteEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Name: entryName,
|
||||
IsDeleteData: isDeleteData,
|
||||
IsRecursive: isRecursive,
|
||||
}
|
||||
|
||||
return s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
stream, err := client.StreamDeleteEntries(context.Background())
|
||||
if err != nil {
|
||||
glog.V(0).Infof("stream delete entry: %v", err)
|
||||
return fmt.Errorf("stream delete entry: %v", err)
|
||||
glog.V(1).Infof("delete entry %v/%v: %v", parentDirectoryPath, entryName, request)
|
||||
if resp, err := client.DeleteEntry(context.Background(), request); err != nil {
|
||||
glog.V(0).Infof("delete entry %v: %v", request, err)
|
||||
return fmt.Errorf("delete entry %s/%s: %v", parentDirectoryPath, entryName, err)
|
||||
} else {
|
||||
if resp.Error != "" {
|
||||
return fmt.Errorf("delete entry %s/%s: %v", parentDirectoryPath, entryName, resp.Error)
|
||||
}
|
||||
|
||||
waitc := make(chan struct{})
|
||||
go func() {
|
||||
for {
|
||||
resp, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
// read done.
|
||||
close(waitc)
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
glog.V(0).Infof("streamRemove: %v", err)
|
||||
return
|
||||
}
|
||||
respFn(resp.Error)
|
||||
}
|
||||
}()
|
||||
|
||||
for {
|
||||
finished, parentDirectoryPath, entryName, isDeleteData, isRecursive := fn()
|
||||
if finished {
|
||||
break
|
||||
}
|
||||
err = stream.Send(&filer_pb.DeleteEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Name: entryName,
|
||||
IsDeleteData: isDeleteData,
|
||||
IsRecursive: isRecursive,
|
||||
IgnoreRecursiveError: quiet,
|
||||
})
|
||||
if err != nil {
|
||||
glog.V(0).Infof("streamRemove: %v", err)
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
stream.CloseSend()
|
||||
<-waitc
|
||||
return err
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) exists(parentDirectoryPath string, entryName string, isDirectory bool) (exists bool, err error) {
|
||||
|
||||
err = s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
return filer_pb.Exists(s3a, parentDirectoryPath, entryName, isDirectory)
|
||||
|
||||
request := &filer_pb.LookupDirectoryEntryRequest{
|
||||
Directory: parentDirectoryPath,
|
||||
Name: entryName,
|
||||
}
|
||||
|
||||
glog.V(4).Infof("exists entry %v/%v: %v", parentDirectoryPath, entryName, request)
|
||||
resp, err := filer_pb.LookupEntry(client, request)
|
||||
if err != nil {
|
||||
if err == filer_pb.ErrNotFound {
|
||||
exists = false
|
||||
return nil
|
||||
}
|
||||
glog.V(0).Infof("exists entry %v: %v", request, err)
|
||||
return fmt.Errorf("exists entry %s/%s: %v", parentDirectoryPath, entryName, err)
|
||||
}
|
||||
|
||||
exists = resp.Entry.IsDirectory == isDirectory
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func objectKey(key *string) *string {
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
@@ -17,11 +16,6 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
)
|
||||
|
||||
var (
|
||||
OS_UID = uint32(os.Getuid())
|
||||
OS_GID = uint32(os.Getgid())
|
||||
)
|
||||
|
||||
type ListAllMyBucketsResult struct {
|
||||
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResult"`
|
||||
Owner *s3.Owner
|
||||
@@ -79,7 +73,7 @@ func (s3a *S3ApiServer) DeleteBucketHandler(w http.ResponseWriter, r *http.Reque
|
||||
vars := mux.Vars(r)
|
||||
bucket := vars["bucket"]
|
||||
|
||||
err := s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
err := s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
// delete collection
|
||||
deleteCollectionRequest := &filer_pb.DeleteCollectionRequest{
|
||||
@@ -94,7 +88,7 @@ func (s3a *S3ApiServer) DeleteBucketHandler(w http.ResponseWriter, r *http.Reque
|
||||
return nil
|
||||
})
|
||||
|
||||
err = s3a.rm(s3a.option.BucketsPath, bucket, true, false, true)
|
||||
err = s3a.rm(s3a.option.BucketsPath, bucket, false, true)
|
||||
|
||||
if err != nil {
|
||||
writeErrorResponse(w, ErrInternalError, r.URL)
|
||||
@@ -109,7 +103,7 @@ func (s3a *S3ApiServer) HeadBucketHandler(w http.ResponseWriter, r *http.Request
|
||||
vars := mux.Vars(r)
|
||||
bucket := vars["bucket"]
|
||||
|
||||
err := s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
err := s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.LookupDirectoryEntryRequest{
|
||||
Directory: s3a.option.BucketsPath,
|
||||
|
||||
@@ -38,7 +38,7 @@ func encodeResponse(response interface{}) []byte {
|
||||
return bytesBuffer.Bytes()
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) withFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {
|
||||
func (s3a *S3ApiServer) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {
|
||||
|
||||
return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
|
||||
client := filer_pb.NewSeaweedFilerClient(grpcConnection)
|
||||
@@ -46,6 +46,9 @@ func (s3a *S3ApiServer) withFilerClient(fn func(filer_pb.SeaweedFilerClient) err
|
||||
}, s3a.option.FilerGrpcAddress, s3a.option.GrpcDialOption)
|
||||
|
||||
}
|
||||
func (s3a *S3ApiServer) AdjustedUrl(hostAndPort string) string {
|
||||
return hostAndPort
|
||||
}
|
||||
|
||||
// If none of the http routes match respond with MethodNotAllowed
|
||||
func notFoundHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/server"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
@@ -165,38 +166,32 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *h
|
||||
return
|
||||
}
|
||||
|
||||
var index int
|
||||
|
||||
var deletedObjects []ObjectIdentifier
|
||||
var deleteErrors []DeleteError
|
||||
s3a.streamRemove(deleteObjects.Quiet, func() (finished bool, parentDirectoryPath string, entryName string, isDeleteData, isRecursive bool) {
|
||||
if index >= len(deleteObjects.Objects) {
|
||||
finished = true
|
||||
return
|
||||
}
|
||||
|
||||
object := deleteObjects.Objects[index]
|
||||
s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
lastSeparator := strings.LastIndex(object.ObjectName, "/")
|
||||
parentDirectoryPath, entryName, isDeleteData, isRecursive = "/", object.ObjectName, true, false
|
||||
if lastSeparator > 0 && lastSeparator+1 < len(object.ObjectName) {
|
||||
entryName = object.ObjectName[lastSeparator+1:]
|
||||
parentDirectoryPath = "/" + object.ObjectName[:lastSeparator]
|
||||
for _, object := range deleteObjects.Objects {
|
||||
lastSeparator := strings.LastIndex(object.ObjectName, "/")
|
||||
parentDirectoryPath, entryName, isDeleteData, isRecursive := "/", object.ObjectName, true, true
|
||||
if lastSeparator > 0 && lastSeparator+1 < len(object.ObjectName) {
|
||||
entryName = object.ObjectName[lastSeparator+1:]
|
||||
parentDirectoryPath = "/" + object.ObjectName[:lastSeparator]
|
||||
}
|
||||
parentDirectoryPath = fmt.Sprintf("%s/%s%s", s3a.option.BucketsPath, bucket, parentDirectoryPath)
|
||||
|
||||
err := doDeleteEntry(client, parentDirectoryPath, entryName, isDeleteData, isRecursive)
|
||||
if err == nil {
|
||||
deletedObjects = append(deletedObjects, object)
|
||||
} else {
|
||||
deleteErrors = append(deleteErrors, DeleteError{
|
||||
Code: "",
|
||||
Message: err.Error(),
|
||||
Key: object.ObjectName,
|
||||
})
|
||||
}
|
||||
}
|
||||
parentDirectoryPath = fmt.Sprintf("%s/%s%s", s3a.option.BucketsPath, bucket, parentDirectoryPath)
|
||||
return
|
||||
}, func(err string) {
|
||||
object := deleteObjects.Objects[index]
|
||||
if err == "" {
|
||||
deletedObjects = append(deletedObjects, object)
|
||||
} else {
|
||||
deleteErrors = append(deleteErrors, DeleteError{
|
||||
Code: "",
|
||||
Message: err,
|
||||
Key: object.ObjectName,
|
||||
})
|
||||
}
|
||||
index++
|
||||
return nil
|
||||
})
|
||||
|
||||
deleteResp := DeleteObjectsResponse{}
|
||||
|
||||
@@ -91,7 +91,7 @@ func (s3a *S3ApiServer) listFilerEntries(bucket, originalPrefix string, maxKeys
|
||||
}
|
||||
|
||||
// check filer
|
||||
err = s3a.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
err = s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.ListEntriesRequest{
|
||||
Directory: fmt.Sprintf("%s/%s/%s", s3a.option.BucketsPath, bucket, dir),
|
||||
|
||||
@@ -224,7 +224,7 @@ func adjustHeadersAfterHEAD(w http.ResponseWriter, r *http.Request, filename str
|
||||
}
|
||||
}
|
||||
|
||||
func processRangeRequst(r *http.Request, w http.ResponseWriter, totalSize int64, mimeType string, writeFn func(writer io.Writer, offset int64, size int64) error) {
|
||||
func processRangeRequest(r *http.Request, w http.ResponseWriter, totalSize int64, mimeType string, writeFn func(writer io.Writer, offset int64, size int64) error) {
|
||||
rangeReq := r.Header.Get("Range")
|
||||
|
||||
if rangeReq == "" {
|
||||
|
||||
@@ -14,11 +14,12 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/operation"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.LookupDirectoryEntryRequest) (*filer_pb.LookupDirectoryEntryResponse, error) {
|
||||
|
||||
entry, err := fs.filer.FindEntry(ctx, filer2.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Name))))
|
||||
entry, err := fs.filer.FindEntry(ctx, util.JoinPath(req.Directory, req.Name))
|
||||
if err == filer_pb.ErrNotFound {
|
||||
return &filer_pb.LookupDirectoryEntryResponse{}, nil
|
||||
}
|
||||
@@ -53,7 +54,7 @@ func (fs *FilerServer) ListEntries(req *filer_pb.ListEntriesRequest, stream file
|
||||
lastFileName := req.StartFromFileName
|
||||
includeLastFile := req.InclusiveStartFrom
|
||||
for limit > 0 {
|
||||
entries, err := fs.filer.ListDirectoryEntries(stream.Context(), filer2.FullPath(req.Directory), lastFileName, includeLastFile, paginationLimit)
|
||||
entries, err := fs.filer.ListDirectoryEntries(stream.Context(), util.FullPath(req.Directory), lastFileName, includeLastFile, paginationLimit)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -136,7 +137,6 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr
|
||||
|
||||
resp = &filer_pb.CreateEntryResponse{}
|
||||
|
||||
fullpath := filer2.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Entry.Name)))
|
||||
chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks)
|
||||
|
||||
if req.Entry.Attributes == nil {
|
||||
@@ -146,7 +146,7 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr
|
||||
}
|
||||
|
||||
createErr := fs.filer.CreateEntry(ctx, &filer2.Entry{
|
||||
FullPath: fullpath,
|
||||
FullPath: util.JoinPath(req.Directory, req.Entry.Name),
|
||||
Attr: filer2.PbToEntryAttribute(req.Entry.Attributes),
|
||||
Chunks: chunks,
|
||||
}, req.OExcl)
|
||||
@@ -163,8 +163,8 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr
|
||||
|
||||
func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntryRequest) (*filer_pb.UpdateEntryResponse, error) {
|
||||
|
||||
fullpath := filepath.ToSlash(filepath.Join(req.Directory, req.Entry.Name))
|
||||
entry, err := fs.filer.FindEntry(ctx, filer2.FullPath(fullpath))
|
||||
fullpath := util.Join(req.Directory, req.Entry.Name)
|
||||
entry, err := fs.filer.FindEntry(ctx, util.FullPath(fullpath))
|
||||
if err != nil {
|
||||
return &filer_pb.UpdateEntryResponse{}, fmt.Errorf("not found %s: %v", fullpath, err)
|
||||
}
|
||||
@@ -175,7 +175,7 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr
|
||||
chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks)
|
||||
|
||||
newEntry := &filer2.Entry{
|
||||
FullPath: filer2.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Entry.Name))),
|
||||
FullPath: util.JoinPath(req.Directory, req.Entry.Name),
|
||||
Attr: entry.Attr,
|
||||
Extended: req.Entry.Extended,
|
||||
Chunks: chunks,
|
||||
@@ -218,7 +218,7 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr
|
||||
}
|
||||
|
||||
func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer_pb.DeleteEntryRequest) (resp *filer_pb.DeleteEntryResponse, err error) {
|
||||
err = fs.filer.DeleteEntryMetaAndData(ctx, filer2.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Name))), req.IsRecursive, req.IgnoreRecursiveError, req.IsDeleteData)
|
||||
err = fs.filer.DeleteEntryMetaAndData(ctx, util.JoinPath(req.Directory, req.Name), req.IsRecursive, req.IgnoreRecursiveError, req.IsDeleteData)
|
||||
resp = &filer_pb.DeleteEntryResponse{}
|
||||
if err != nil {
|
||||
resp.Error = err.Error()
|
||||
@@ -226,25 +226,6 @@ func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer_pb.DeleteEntr
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (fs *FilerServer) StreamDeleteEntries(stream filer_pb.SeaweedFiler_StreamDeleteEntriesServer) error {
|
||||
for {
|
||||
req, err := stream.Recv()
|
||||
if err != nil {
|
||||
return fmt.Errorf("receive delete entry request: %v", err)
|
||||
}
|
||||
fullpath := filer2.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Name)))
|
||||
err = fs.filer.DeleteEntryMetaAndData(context.Background(), fullpath, req.IsRecursive, req.IgnoreRecursiveError, req.IsDeleteData)
|
||||
resp := &filer_pb.DeleteEntryResponse{}
|
||||
if err != nil {
|
||||
resp.Error = err.Error()
|
||||
}
|
||||
if err := stream.Send(resp); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fs *FilerServer) AssignVolume(ctx context.Context, req *filer_pb.AssignVolumeRequest) (resp *filer_pb.AssignVolumeResponse, err error) {
|
||||
|
||||
ttlStr := ""
|
||||
@@ -311,13 +292,22 @@ func (fs *FilerServer) DeleteCollection(ctx context.Context, req *filer_pb.Delet
|
||||
|
||||
func (fs *FilerServer) Statistics(ctx context.Context, req *filer_pb.StatisticsRequest) (resp *filer_pb.StatisticsResponse, err error) {
|
||||
|
||||
input := &master_pb.StatisticsRequest{
|
||||
Replication: req.Replication,
|
||||
Collection: req.Collection,
|
||||
Ttl: req.Ttl,
|
||||
}
|
||||
var output *master_pb.StatisticsResponse
|
||||
|
||||
err = fs.filer.MasterClient.WithClient(func(masterClient master_pb.SeaweedClient) error {
|
||||
grpcResponse, grpcErr := masterClient.Statistics(context.Background(), &master_pb.StatisticsRequest{
|
||||
Replication: req.Replication,
|
||||
Collection: req.Collection,
|
||||
Ttl: req.Ttl,
|
||||
})
|
||||
if grpcErr != nil {
|
||||
return grpcErr
|
||||
}
|
||||
|
||||
output = grpcResponse
|
||||
return nil
|
||||
})
|
||||
|
||||
output, err := operation.Statistics(fs.filer.GetMaster(), fs.grpcDialOption, input)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package weed_server
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func (fs *FilerServer) ListenForEvents(req *filer_pb.ListenForEventsRequest, stream filer_pb.SeaweedFiler_ListenForEventsServer) error {
|
||||
|
||||
peerAddress := findClientAddress(stream.Context(), 0)
|
||||
|
||||
clientName := fs.addClient(req.ClientName, peerAddress)
|
||||
|
||||
defer fs.deleteClient(clientName)
|
||||
|
||||
lastReadTime := time.Now()
|
||||
if req.SinceNs > 0 {
|
||||
lastReadTime = time.Unix(0, req.SinceNs)
|
||||
}
|
||||
var readErr error
|
||||
for {
|
||||
|
||||
lastReadTime, readErr = fs.filer.ReadLogBuffer(lastReadTime, func(dirPath string, eventNotification *filer_pb.EventNotification) error {
|
||||
|
||||
// get complete path to the file or directory
|
||||
var entryName string
|
||||
if eventNotification.OldEntry != nil {
|
||||
entryName = eventNotification.OldEntry.Name
|
||||
} else if eventNotification.NewEntry != nil {
|
||||
entryName = eventNotification.NewEntry.Name
|
||||
}
|
||||
|
||||
fullpath := util.Join(dirPath, entryName)
|
||||
|
||||
// skip on filer internal meta logs
|
||||
if strings.HasPrefix(fullpath, "/.meta") {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(fullpath, req.PathPrefix) {
|
||||
return nil
|
||||
}
|
||||
|
||||
message := &filer_pb.FullEventNotification{
|
||||
Directory: dirPath,
|
||||
EventNotification: eventNotification,
|
||||
}
|
||||
if err := stream.Send(message); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if readErr != nil {
|
||||
glog.V(0).Infof("=> client %v: %+v", clientName, readErr)
|
||||
return readErr
|
||||
}
|
||||
|
||||
fs.listenersLock.Lock()
|
||||
fs.listenersCond.Wait()
|
||||
fs.listenersLock.Unlock()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fs *FilerServer) addClient(clientType string, clientAddress string) (clientName string) {
|
||||
clientName = clientType + "@" + clientAddress
|
||||
glog.V(0).Infof("+ listener %v", clientName)
|
||||
return
|
||||
}
|
||||
|
||||
func (fs *FilerServer) deleteClient(clientName string) {
|
||||
glog.V(0).Infof("- listener %v", clientName)
|
||||
}
|
||||
|
||||
func (fs *FilerServer) notifyMetaListeners() {
|
||||
fs.listenersCond.Broadcast()
|
||||
}
|
||||
@@ -3,10 +3,12 @@ package weed_server
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"path/filepath"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func (fs *FilerServer) AtomicRenameEntry(ctx context.Context, req *filer_pb.AtomicRenameEntryRequest) (*filer_pb.AtomicRenameEntryResponse, error) {
|
||||
@@ -18,7 +20,7 @@ func (fs *FilerServer) AtomicRenameEntry(ctx context.Context, req *filer_pb.Atom
|
||||
return nil, err
|
||||
}
|
||||
|
||||
oldParent := filer2.FullPath(filepath.ToSlash(req.OldDirectory))
|
||||
oldParent := util.FullPath(filepath.ToSlash(req.OldDirectory))
|
||||
|
||||
oldEntry, err := fs.filer.FindEntry(ctx, oldParent.Child(req.OldName))
|
||||
if err != nil {
|
||||
@@ -27,7 +29,7 @@ func (fs *FilerServer) AtomicRenameEntry(ctx context.Context, req *filer_pb.Atom
|
||||
}
|
||||
|
||||
var events MoveEvents
|
||||
moveErr := fs.moveEntry(ctx, oldParent, oldEntry, filer2.FullPath(filepath.ToSlash(req.NewDirectory)), req.NewName, &events)
|
||||
moveErr := fs.moveEntry(ctx, oldParent, oldEntry, util.FullPath(filepath.ToSlash(req.NewDirectory)), req.NewName, &events)
|
||||
if moveErr != nil {
|
||||
fs.filer.RollbackTransaction(ctx)
|
||||
return nil, fmt.Errorf("%s/%s move error: %v", req.OldDirectory, req.OldName, err)
|
||||
@@ -38,17 +40,10 @@ func (fs *FilerServer) AtomicRenameEntry(ctx context.Context, req *filer_pb.Atom
|
||||
}
|
||||
}
|
||||
|
||||
for _, entry := range events.newEntries {
|
||||
fs.filer.NotifyUpdateEvent(nil, entry, false)
|
||||
}
|
||||
for _, entry := range events.oldEntries {
|
||||
fs.filer.NotifyUpdateEvent(entry, nil, false)
|
||||
}
|
||||
|
||||
return &filer_pb.AtomicRenameEntryResponse{}, nil
|
||||
}
|
||||
|
||||
func (fs *FilerServer) moveEntry(ctx context.Context, oldParent filer2.FullPath, entry *filer2.Entry, newParent filer2.FullPath, newName string, events *MoveEvents) error {
|
||||
func (fs *FilerServer) moveEntry(ctx context.Context, oldParent util.FullPath, entry *filer2.Entry, newParent util.FullPath, newName string, events *MoveEvents) error {
|
||||
if entry.IsDirectory() {
|
||||
if err := fs.moveFolderSubEntries(ctx, oldParent, entry, newParent, newName, events); err != nil {
|
||||
return err
|
||||
@@ -57,7 +52,7 @@ func (fs *FilerServer) moveEntry(ctx context.Context, oldParent filer2.FullPath,
|
||||
return fs.moveSelfEntry(ctx, oldParent, entry, newParent, newName, events)
|
||||
}
|
||||
|
||||
func (fs *FilerServer) moveFolderSubEntries(ctx context.Context, oldParent filer2.FullPath, entry *filer2.Entry, newParent filer2.FullPath, newName string, events *MoveEvents) error {
|
||||
func (fs *FilerServer) moveFolderSubEntries(ctx context.Context, oldParent util.FullPath, entry *filer2.Entry, newParent util.FullPath, newName string, events *MoveEvents) error {
|
||||
|
||||
currentDirPath := oldParent.Child(entry.Name())
|
||||
newDirPath := newParent.Child(newName)
|
||||
@@ -90,7 +85,7 @@ func (fs *FilerServer) moveFolderSubEntries(ctx context.Context, oldParent filer
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fs *FilerServer) moveSelfEntry(ctx context.Context, oldParent filer2.FullPath, entry *filer2.Entry, newParent filer2.FullPath, newName string, events *MoveEvents) error {
|
||||
func (fs *FilerServer) moveSelfEntry(ctx context.Context, oldParent util.FullPath, entry *filer2.Entry, newParent util.FullPath, newName string, events *MoveEvents) error {
|
||||
|
||||
oldPath, newPath := oldParent.Child(entry.Name()), newParent.Child(newName)
|
||||
|
||||
|
||||
+28
-11
@@ -5,11 +5,13 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/operation"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/stats"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
@@ -52,6 +54,10 @@ type FilerServer struct {
|
||||
secret security.SigningKey
|
||||
filer *filer2.Filer
|
||||
grpcDialOption grpc.DialOption
|
||||
|
||||
// notifying clients
|
||||
listenersLock sync.Mutex
|
||||
listenersCond *sync.Cond
|
||||
}
|
||||
|
||||
func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) (fs *FilerServer, err error) {
|
||||
@@ -60,14 +66,17 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
|
||||
option: option,
|
||||
grpcDialOption: security.LoadClientTLS(util.GetViper(), "grpc.filer"),
|
||||
}
|
||||
fs.listenersCond = sync.NewCond(&fs.listenersLock)
|
||||
|
||||
if len(option.Masters) == 0 {
|
||||
glog.Fatal("master list is required!")
|
||||
}
|
||||
|
||||
fs.filer = filer2.NewFiler(option.Masters, fs.grpcDialOption, option.Port+10000)
|
||||
fs.filer = filer2.NewFiler(option.Masters, fs.grpcDialOption, option.Port+10000, fs.notifyMetaListeners)
|
||||
fs.filer.Cipher = option.Cipher
|
||||
|
||||
maybeStartMetrics(fs, option)
|
||||
|
||||
go fs.filer.KeepConnectedToMaster()
|
||||
|
||||
v := util.GetViper()
|
||||
@@ -100,8 +109,6 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
|
||||
|
||||
fs.filer.LoadBuckets(fs.filer.DirBucketsPath)
|
||||
|
||||
maybeStartMetrics(fs, option)
|
||||
|
||||
util.OnInterrupt(func() {
|
||||
fs.filer.Shutdown()
|
||||
})
|
||||
@@ -110,16 +117,26 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
|
||||
}
|
||||
|
||||
func maybeStartMetrics(fs *FilerServer, option *FilerOption) {
|
||||
|
||||
for _, master := range option.Masters {
|
||||
_, err := pb.ParseFilerGrpcAddress(master)
|
||||
if err != nil {
|
||||
glog.Fatalf("invalid master address %s: %v", master, err)
|
||||
}
|
||||
}
|
||||
|
||||
isConnected := false
|
||||
var metricsAddress string
|
||||
var metricsIntervalSec int
|
||||
var readErr error
|
||||
for !isConnected {
|
||||
metricsAddress, metricsIntervalSec, readErr = readFilerConfiguration(fs.grpcDialOption, option.Masters[0])
|
||||
if readErr == nil {
|
||||
isConnected = true
|
||||
} else {
|
||||
time.Sleep(7 * time.Second)
|
||||
for _, master := range option.Masters {
|
||||
metricsAddress, metricsIntervalSec, readErr = readFilerConfiguration(fs.grpcDialOption, master)
|
||||
if readErr == nil {
|
||||
isConnected = true
|
||||
} else {
|
||||
time.Sleep(7 * time.Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
if metricsAddress == "" && metricsIntervalSec <= 0 {
|
||||
@@ -131,11 +148,11 @@ func maybeStartMetrics(fs *FilerServer, option *FilerOption) {
|
||||
})
|
||||
}
|
||||
|
||||
func readFilerConfiguration(grpcDialOption grpc.DialOption, masterGrpcAddress string) (metricsAddress string, metricsIntervalSec int, err error) {
|
||||
err = operation.WithMasterServerClient(masterGrpcAddress, grpcDialOption, func(masterClient master_pb.SeaweedClient) error {
|
||||
func readFilerConfiguration(grpcDialOption grpc.DialOption, masterAddress string) (metricsAddress string, metricsIntervalSec int, err error) {
|
||||
err = operation.WithMasterServerClient(masterAddress, grpcDialOption, func(masterClient master_pb.SeaweedClient) error {
|
||||
resp, err := masterClient.GetMasterConfiguration(context.Background(), &master_pb.GetMasterConfigurationRequest{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("get master %s configuration: %v", masterGrpcAddress, err)
|
||||
return fmt.Errorf("get master %s configuration: %v", masterAddress, err)
|
||||
}
|
||||
metricsAddress, metricsIntervalSec = resp.MetricsAddress, int(resp.MetricsIntervalSeconds)
|
||||
return nil
|
||||
|
||||
@@ -11,8 +11,10 @@ import (
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/images"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/stats"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) {
|
||||
@@ -23,7 +25,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
|
||||
path = path[:len(path)-1]
|
||||
}
|
||||
|
||||
entry, err := fs.filer.FindEntry(context.Background(), filer2.FullPath(path))
|
||||
entry, err := fs.filer.FindEntry(context.Background(), util.FullPath(path))
|
||||
if err != nil {
|
||||
if path == "/" {
|
||||
fs.listDirectoryHandler(w, r)
|
||||
@@ -89,8 +91,19 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
|
||||
|
||||
totalSize := int64(filer2.TotalSize(entry.Chunks))
|
||||
|
||||
processRangeRequst(r, w, totalSize, mimeType, func(writer io.Writer, offset int64, size int64) error {
|
||||
return filer2.StreamContent(fs.filer.MasterClient, w, entry.Chunks, offset, int(size))
|
||||
if rangeReq := r.Header.Get("Range"); rangeReq == "" {
|
||||
ext := filepath.Ext(filename)
|
||||
width, height, mode, shouldResize := shouldResizeImages(ext, r)
|
||||
if shouldResize {
|
||||
chunkedFileReader := filer2.NewChunkStreamReaderFromFiler(fs.filer.MasterClient, entry.Chunks)
|
||||
rs, _, _ := images.Resized(ext, chunkedFileReader, width, height, mode)
|
||||
io.Copy(w, rs)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
processRangeRequest(r, w, totalSize, mimeType, func(writer io.Writer, offset int64, size int64) error {
|
||||
return filer2.StreamContent(fs.filer.MasterClient, writer, entry.Chunks, offset, size)
|
||||
})
|
||||
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
ui "github.com/chrislusf/seaweedfs/weed/server/filer_ui"
|
||||
"github.com/chrislusf/seaweedfs/weed/stats"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
// listDirectoryHandler lists directories and folers under a directory
|
||||
@@ -32,7 +32,7 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque
|
||||
|
||||
lastFileName := r.FormValue("lastFileName")
|
||||
|
||||
entries, err := fs.filer.ListDirectoryEntries(context.Background(), filer2.FullPath(path), lastFileName, false, limit)
|
||||
entries, err := fs.filer.ListDirectoryEntries(context.Background(), util.FullPath(path), lastFileName, false, limit)
|
||||
|
||||
if err != nil {
|
||||
glog.V(0).Infof("listDirectory %s %s %d: %s", path, lastFileName, limit, err)
|
||||
|
||||
@@ -169,13 +169,13 @@ func (fs *FilerServer) updateFilerStore(ctx context.Context, r *http.Request, w
|
||||
path += ret.Name
|
||||
}
|
||||
}
|
||||
existingEntry, err := fs.filer.FindEntry(ctx, filer2.FullPath(path))
|
||||
existingEntry, err := fs.filer.FindEntry(ctx, util.FullPath(path))
|
||||
crTime := time.Now()
|
||||
if err == nil && existingEntry != nil {
|
||||
crTime = existingEntry.Crtime
|
||||
}
|
||||
entry := &filer2.Entry{
|
||||
FullPath: filer2.FullPath(path),
|
||||
FullPath: util.FullPath(path),
|
||||
Attr: filer2.Attr{
|
||||
Mtime: time.Now(),
|
||||
Crtime: crTime,
|
||||
@@ -304,7 +304,7 @@ func (fs *FilerServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ignoreRecursiveError := r.FormValue("ignoreRecursiveError") == "true"
|
||||
skipChunkDeletion := r.FormValue("skipChunkDeletion") == "true"
|
||||
|
||||
err := fs.filer.DeleteEntryMetaAndData(context.Background(), filer2.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError, !skipChunkDeletion)
|
||||
err := fs.filer.DeleteEntryMetaAndData(context.Background(), util.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError, !skipChunkDeletion)
|
||||
if err != nil {
|
||||
glog.V(1).Infoln("deleting", r.URL.Path, ":", err.Error())
|
||||
httpStatus := http.StatusInternalServerError
|
||||
|
||||
Loaded 100 of 153 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user