Browse Source

Merge pull request #30 from chrislusf/master

sync
pull/1620/head
hilimd 4 years ago
committed by GitHub
parent
commit
2c40f56e5a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docker/Dockerfile.go_build
  2. 4
      docker/Dockerfile.go_build_large
  3. 2
      weed/filesys/wfs_write.go
  4. 6
      weed/server/filer_server_handlers_write.go

4
docker/Dockerfile.go_build

@ -2,7 +2,9 @@ FROM frolvlad/alpine-glibc as builder
RUN apk add git go g++
RUN mkdir -p /go/src/github.com/chrislusf/
RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs
RUN cd /go/src/github.com/chrislusf/seaweedfs/weed && go install
RUN cd /go/src/github.com/chrislusf/seaweedfs/weed \
&& export LDFLAGS="-X github.com/chrislusf/seaweedfs/weed/util.COMMIT=$(git rev-parse --short HEAD)" \
&& go install -ldflags "${LDFLAGS}"
FROM alpine AS final
LABEL author="Chris Lu"

4
docker/Dockerfile.go_build_large

@ -2,7 +2,9 @@ FROM frolvlad/alpine-glibc as builder
RUN apk add git go g++
RUN mkdir -p /go/src/github.com/chrislusf/
RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs
RUN cd /go/src/github.com/chrislusf/seaweedfs/weed && go install -tags 5BytesOffset
RUN cd /go/src/github.com/chrislusf/seaweedfs/weed \
&& export LDFLAGS="-X github.com/chrislusf/seaweedfs/weed/util.COMMIT=$(git rev-parse --short HEAD)" \
&& go install -tags 5BytesOffset -ldflags "${LDFLAGS}"
FROM alpine AS final
LABEL author="Chris Lu"

2
weed/filesys/wfs_write.go

@ -65,6 +65,6 @@ func (wfs *WFS) saveDataAsChunk(dir string) filer.SaveDataAsChunkFunctionType {
wfs.chunkCache.SetChunk(fileId, data)
chunk = uploadResult.ToPbFileChunk(fileId, offset)
return chunk, "", "", nil
return chunk, collection, replication, nil
}
}

6
weed/server/filer_server_handlers_write.go

@ -139,6 +139,7 @@ func (fs *FilerServer) detectCollection(requestURI, qCollection, qReplication st
}
// required by buckets folder
bucketDefaultReplication := ""
if strings.HasPrefix(requestURI, fs.filer.DirBucketsPath+"/") {
bucketAndObjectKey := requestURI[len(fs.filer.DirBucketsPath)+1:]
t := strings.Index(bucketAndObjectKey, "/")
@ -148,7 +149,10 @@ func (fs *FilerServer) detectCollection(requestURI, qCollection, qReplication st
if t > 0 {
collection = bucketAndObjectKey[:t]
}
replication, fsync = fs.filer.ReadBucketOption(collection)
bucketDefaultReplication, fsync = fs.filer.ReadBucketOption(collection)
}
if replication == "" {
replication = bucketDefaultReplication
}
return

Loading…
Cancel
Save