Documentation
¶
Overview ¶
Copyright 2019 Google LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func BackupBlob(pn string, np int, maxPage int, ctimeout time.Duration) ([]error, *documentpb.Document)
- func CheckBlob(pn string, np int, maxPage int) int
- func CheckBlobs(request datatype.ListObjRequest, maxLoop int, maxPage int)
- func CheckBucketName(srcBucket string, tgtBucket string) (err error)
- func CheckPdfAndP0(pn string, usermd string) (pdf bool, p0 bool)
- func CheckTargetSproxyd(request datatype.ListObjRequest, maxLoop int, maxPage int)
- func CloneBlob(pn string, np int, maxPage int, replace bool) (int, *documentpb.Document)
- func CompletedUpload(svc *s3.S3, resp *s3.CreateMultipartUploadOutput, part []*s3.CompletedPart)
- func CreateS3Session(op string, location string) *s3.S3
- func DeleteDocMetadata(request *sproxyd.HttpRequest, document *documentpb.Document) (int, int)
- func GetBucketSuffix(bucket string, prefix string) (err error, s string)
- func GetCurrentDate() string
- func GetDocMetaStatus(request sproxyd.HttpRequest, env string, pn string) (err error, status int, usermd string)
- func GetDocument(bytes []byte) (*documentpb.Document, error)
- func GetDocumentMeta(key string) (*moses.DocumentMetadata, error, int)
- func GetHeader(request sproxyd.HttpRequest) (err error, usermd string, contentLength int64)
- func GetObject(request sproxyd.HttpRequest, pn string) (error, string, *[]byte)
- func GetPageNumber(key string) (int, error, int)
- func GetPathName(pathId string) (err error, pathName string, status int)
- func GetUserMeta(request sproxyd.HttpRequest, pn string) (err error, usermd string)
- func GetUserMetaWithPathId(pathId string) (err error, usermd string, status int)
- func HasSuffix(bucket string) bool
- func HashKey(key string, modulo int) (v int)
- func IndexDocument(document *documentpb.Document, bucket string, service *s3.S3, ...) (*s3.PutObjectOutput, error)
- func InspectBlobs(document *documentpb.Document, maxPage int, verbose bool)
- func ListBlob(pn string, np int, maxPage int) int
- func ListBlobs(request datatype.ListObjRequest, maxLoop int, maxPage int)
- func ListPn(buf *bufio.Scanner, num int) (*s3.ListObjectsV2Output, error)
- func Logit(logReq LogRequest)
- func MigrateBlob(reqm datatype.Reqm, s3meta string, pn string, np int, ctimeout time.Duration) (int, *documentpb.Document)
- func OpByIds(method string, request datatype.ListObjRequest, maxLoop int, replace bool, ...)
- func ParseInputKey(key string) (error, string)
- func ParseLog(line string) (error, string, string)
- func ParseLoggerKey(key string) (error, string)
- func Profiling(profiling int)
- func ReadDocument(pn string, inDir string) (*documentpb.Document, error)
- func ReadMultipartS3(service *s3.S3, bucket string, key string) (int64, *aws.WriteAtBuffer, error)
- func ReadS3(service *s3.S3, bucket string, key string) (*s3.GetObjectOutput, error)
- func RepairIt(resp *http.Response, request *sproxyd.HttpRequest, replace bool) error
- func RestoreBlobs(document *documentpb.Document, ctimeout time.Duration) int
- func Restores3Objects(service *s3.S3, bucket string, document *documentpb.Document, ...) int
- func SetBucketName(prefix string, bucket string) (name string)
- func SetBucketName1(condition bool, pn string, bucket string) (buck1 string)
- func SetLocationSproxyd(op string, location string, srcUrl string, driver string, env string) error
- func SetSourceSproxyd(op string, srcUrl string, driver string, env string) error
- func SetTargetSproxyd(op string, targetUrl string, targetDriver string, targetEnv string) error
- func UploadPart(upload datatype.UploadPartRequest) (*s3.CompletedPart, error)
- func WriteDirectory(pn string, document *documentpb.Document, outdir string) (error, int)
- func WriteDocMetadata(request *sproxyd.HttpRequest, document *documentpb.Document, replace bool) (int, int)
- func WriteDocPage(request sproxyd.HttpRequest, pg *documentpb.Page, replace bool) (int, int)
- func WriteDocPdf(pd *documentpb.Pdf, replace bool) (int, int)
- func WriteDocumentToFile(document *documentpb.Document, pn string, outDir string)
- func WriteS3(service *s3.S3, bucket string, document *documentpb.Document, ...) (*s3.PutObjectOutput, error)
- func WriteS3Metadata(service *s3.S3, bucket string, document *documentpb.Document, ...) (*s3.PutObjectOutput, error)
- func WriteS3Multipart(service *s3.S3, bucket string, maxPartSize int64, ...) ([]error, error)
- func WriteS3Page(service *s3.S3, bucket string, page *documentpb.Page, ctimeout time.Duration) (*s3.PutObjectOutput, error)
- func WriteS3Pdf(service *s3.S3, bucket string, pdf *documentpb.Pdf, ctimeout time.Duration) (*s3.PutObjectOutput, error)
- type GetBlobResponse
- type LogBackup
- type LogRequest
- type Resp
- type Ret
- type RingId
Constants ¶
const ( LEHeader = "II\x2A\x00" // Header for little-endian files. BEHeader = "MM\x00\x2A" // Header for big-endian files. 4D 4D 00 2A )
const (
MinPartSize = 1024 * 1014 * 5 // 5 MB
)
Variables ¶
var ( MaxPage int // Number of max pages to be concurrentlz processed MaxPageSize int64 // maximum page size for multipart upload or dowbload MaxPartSize int64 MaxCon int // Maximum number of concurrent upload /download PartNumber int64 //number of parts in a multi par upload /download Replace bool )
Functions ¶
func BackupBlob ¶
func CheckBlobs ¶
func CheckBlobs(request datatype.ListObjRequest, maxLoop int, maxPage int)
Check pn's returned by listObject of the meta bucket
func CheckBucketName ¶
func CheckTargetSproxyd ¶
func CheckTargetSproxyd(request datatype.ListObjRequest, maxLoop int, maxPage int)
func CompletedUpload ¶
func CompletedUpload(svc *s3.S3, resp *s3.CreateMultipartUploadOutput, part []*s3.CompletedPart)
func DeleteDocMetadata ¶
func DeleteDocMetadata(request *sproxyd.HttpRequest, document *documentpb.Document) (int, int)
func GetCurrentDate ¶
func GetCurrentDate() string
func GetDocMetaStatus ¶
func GetDocument ¶
func GetDocument(bytes []byte) (*documentpb.Document, error)
Document -> document structure
func GetDocumentMeta ¶
func GetDocumentMeta(key string) (*moses.DocumentMetadata, error, int)
func GetUserMeta ¶
func GetUserMetaWithPathId ¶
func IndexDocument ¶
func IndexDocument(document *documentpb.Document, bucket string, service *s3.S3, ctimeout time.Duration) (*s3.PutObjectOutput, error)
func InspectBlobs ¶
func InspectBlobs(document *documentpb.Document, maxPage int, verbose bool)
func ListBlobs ¶
func ListBlobs(request datatype.ListObjRequest, maxLoop int, maxPage int)
Check pn's returned by listObject of the meta bucket
func Logit ¶
func Logit(logReq LogRequest)
func MigrateBlob ¶
func ParseInputKey ¶
func ParseLoggerKey ¶
func ReadDocument ¶
func ReadDocument(pn string, inDir string) (*documentpb.Document, error)
Read Document from a file into a document structure
func ReadMultipartS3 ¶
func RestoreBlobs ¶
func RestoreBlobs(document *documentpb.Document, ctimeout time.Duration) int
func Restores3Objects ¶
func SetBucketName ¶
func SetLocationSproxyd ¶
func SetSourceSproxyd ¶
func SetTargetSproxyd ¶
func UploadPart ¶
func UploadPart(upload datatype.UploadPartRequest) (*s3.CompletedPart, error)
func WriteDirectory ¶
Write document to file
func WriteDocMetadata ¶
func WriteDocMetadata(request *sproxyd.HttpRequest, document *documentpb.Document, replace bool) (int, int)
func WriteDocPage ¶
func WriteDocPage(request sproxyd.HttpRequest, pg *documentpb.Page, replace bool) (int, int)
func WriteDocPdf ¶
func WriteDocPdf(pd *documentpb.Pdf, replace bool) (int, int)
func WriteDocumentToFile ¶
func WriteDocumentToFile(document *documentpb.Document, pn string, outDir string)
Write the document to file( pages + meta dada) To be completed ( page 0 and pdf are not yet taken into account
func WriteS3 ¶
func WriteS3(service *s3.S3, bucket string, document *documentpb.Document, ctimeout time.Duration) (*s3.PutObjectOutput, error)
func WriteS3Metadata ¶
func WriteS3Metadata(service *s3.S3, bucket string, document *documentpb.Document, ctimeout time.Duration) (*s3.PutObjectOutput, error)
func WriteS3Multipart ¶
func WriteS3Page ¶
func WriteS3Page(service *s3.S3, bucket string, page *documentpb.Page, ctimeout time.Duration) (*s3.PutObjectOutput, error)
func WriteS3Pdf ¶
func WriteS3Pdf(service *s3.S3, bucket string, pdf *documentpb.Pdf, ctimeout time.Duration) (*s3.PutObjectOutput, error)
Types ¶
type GetBlobResponse ¶
type LogBackup ¶
type LogBackup struct { Method string `json:"method,omitempty"` Incremental bool `json:"incremental,omitempty"` Key string `json:"document-id"` Bucket string `json:"bucket-name"` Pages int `json:"number-pages"` Size int64 `json:"document-size"` Pubdate string `json:"publication-date,omitempty"` Loaddate string `json:"load-date,omitempty"` Errors int `json:"number-errors"` }
type LogRequest ¶
Source Files
¶
- backBlobs.go
- catchUpBlobs.go
- checkBlobs.go
- cloneBlobs.go
- common.go
- createSession.go
- getBucketSuffix.go
- getSproxyd.go
- indexDocument.go
- inspectBlobs.go
- listBlobs.go
- listPn.go
- logIt.go
- migrateBlobs.go
- putObjIds.go
- readDocument.go
- readS3.go
- restBlobs.go
- setBucketName.go
- setSproxyd.go
- utils.go
- writeFile.go
- writeS3.go
- writeSproxyd.go