id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
26,700
minio/minio-go
api-error-response.go
Error
func (e ErrorResponse) Error() string { if e.Message == "" { msg, ok := s3ErrorResponseMap[e.Code] if !ok { msg = fmt.Sprintf("Error response code %s.", e.Code) } return msg } return e.Message }
go
func (e ErrorResponse) Error() string { if e.Message == "" { msg, ok := s3ErrorResponseMap[e.Code] if !ok { msg = fmt.Sprintf("Error response code %s.", e.Code) } return msg } return e.Message }
[ "func", "(", "e", "ErrorResponse", ")", "Error", "(", ")", "string", "{", "if", "e", ".", "Message", "==", "\"", "\"", "{", "msg", ",", "ok", ":=", "s3ErrorResponseMap", "[", "e", ".", "Code", "]", "\n", "if", "!", "ok", "{", "msg", "=", "fmt", ...
// Error - Returns S3 error string.
[ "Error", "-", "Returns", "S3", "error", "string", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L81-L90
26,701
minio/minio-go
api-error-response.go
ErrTransferAccelerationBucket
func ErrTransferAccelerationBucket(bucketName string) error { return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "InvalidArgument", Message: "The name of the bucket used for Transfer Acceleration must be DNS-compliant and must not contain periods β€˜.’.", BucketName: bucketName, } }
go
func ErrTransferAccelerationBucket(bucketName string) error { return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "InvalidArgument", Message: "The name of the bucket used for Transfer Acceleration must be DNS-compliant and must not contain periods β€˜.’.", BucketName: bucketName, } }
[ "func", "ErrTransferAccelerationBucket", "(", "bucketName", "string", ")", "error", "{", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ".", "StatusBadRequest", ",", "Code", ":", "\"", "\"", ",", "Message", ":", "\"", "", "", "BucketName", ":", "...
// ErrTransferAccelerationBucket - bucket name is invalid to be used with transfer acceleration.
[ "ErrTransferAccelerationBucket", "-", "bucket", "name", "is", "invalid", "to", "be", "used", "with", "transfer", "acceleration", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L183-L190
26,702
minio/minio-go
api-error-response.go
ErrEntityTooLarge
func ErrEntityTooLarge(totalSize, maxObjectSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Your proposed upload size β€˜%d’ exceeds the maximum allowed object size β€˜%d’ for single PUT operation.", totalSize, maxObjectSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "...
go
func ErrEntityTooLarge(totalSize, maxObjectSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Your proposed upload size β€˜%d’ exceeds the maximum allowed object size β€˜%d’ for single PUT operation.", totalSize, maxObjectSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "...
[ "func", "ErrEntityTooLarge", "(", "totalSize", ",", "maxObjectSize", "int64", ",", "bucketName", ",", "objectName", "string", ")", "error", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "S", "i", "e, maxObj", "e", "tSize)", "", "\n", "return", "Error...
// ErrEntityTooLarge - Input size is larger than supported maximum.
[ "ErrEntityTooLarge", "-", "Input", "size", "is", "larger", "than", "supported", "maximum", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L193-L202
26,703
minio/minio-go
api-error-response.go
ErrEntityTooSmall
func ErrEntityTooSmall(totalSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Your proposed upload size β€˜%d’ is below the minimum allowed object size β€˜0B’ for single PUT operation.", totalSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "EntityTooSmall", Message: ...
go
func ErrEntityTooSmall(totalSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Your proposed upload size β€˜%d’ is below the minimum allowed object size β€˜0B’ for single PUT operation.", totalSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "EntityTooSmall", Message: ...
[ "func", "ErrEntityTooSmall", "(", "totalSize", "int64", ",", "bucketName", ",", "objectName", "string", ")", "error", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "S", "i", "e)", "", "\n", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ...
// ErrEntityTooSmall - Input size is smaller than supported minimum.
[ "ErrEntityTooSmall", "-", "Input", "size", "is", "smaller", "than", "supported", "minimum", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L205-L214
26,704
minio/minio-go
api-error-response.go
ErrUnexpectedEOF
func ErrUnexpectedEOF(totalRead, totalSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Data read β€˜%d’ is not equal to the size β€˜%d’ of the input Reader.", totalRead, totalSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "UnexpectedEOF", Message: msg, BucketNa...
go
func ErrUnexpectedEOF(totalRead, totalSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Data read β€˜%d’ is not equal to the size β€˜%d’ of the input Reader.", totalRead, totalSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "UnexpectedEOF", Message: msg, BucketNa...
[ "func", "ErrUnexpectedEOF", "(", "totalRead", ",", "totalSize", "int64", ",", "bucketName", ",", "objectName", "string", ")", "error", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "R", "e", "d, totalS", "i", "e)", "", "\n", "return", "ErrorResponse"...
// ErrUnexpectedEOF - Unexpected end of file reached.
[ "ErrUnexpectedEOF", "-", "Unexpected", "end", "of", "file", "reached", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L217-L226
26,705
minio/minio-go
api-error-response.go
ErrInvalidBucketName
func ErrInvalidBucketName(message string) error { return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "InvalidBucketName", Message: message, RequestID: "minio", } }
go
func ErrInvalidBucketName(message string) error { return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "InvalidBucketName", Message: message, RequestID: "minio", } }
[ "func", "ErrInvalidBucketName", "(", "message", "string", ")", "error", "{", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ".", "StatusBadRequest", ",", "Code", ":", "\"", "\"", ",", "Message", ":", "message", ",", "RequestID", ":", "\"", "\"", ...
// ErrInvalidBucketName - Invalid bucket name response.
[ "ErrInvalidBucketName", "-", "Invalid", "bucket", "name", "response", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L229-L236
26,706
minio/minio-go
api-error-response.go
ErrInvalidObjectName
func ErrInvalidObjectName(message string) error { return ErrorResponse{ StatusCode: http.StatusNotFound, Code: "NoSuchKey", Message: message, RequestID: "minio", } }
go
func ErrInvalidObjectName(message string) error { return ErrorResponse{ StatusCode: http.StatusNotFound, Code: "NoSuchKey", Message: message, RequestID: "minio", } }
[ "func", "ErrInvalidObjectName", "(", "message", "string", ")", "error", "{", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ".", "StatusNotFound", ",", "Code", ":", "\"", "\"", ",", "Message", ":", "message", ",", "RequestID", ":", "\"", "\"", ...
// ErrInvalidObjectName - Invalid object name response.
[ "ErrInvalidObjectName", "-", "Invalid", "object", "name", "response", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L239-L246
26,707
minio/minio-go
api-error-response.go
ErrAPINotSupported
func ErrAPINotSupported(message string) error { return ErrorResponse{ StatusCode: http.StatusNotImplemented, Code: "APINotSupported", Message: message, RequestID: "minio", } }
go
func ErrAPINotSupported(message string) error { return ErrorResponse{ StatusCode: http.StatusNotImplemented, Code: "APINotSupported", Message: message, RequestID: "minio", } }
[ "func", "ErrAPINotSupported", "(", "message", "string", ")", "error", "{", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ".", "StatusNotImplemented", ",", "Code", ":", "\"", "\"", ",", "Message", ":", "message", ",", "RequestID", ":", "\"", "\""...
// ErrAPINotSupported - API not supported response // The specified API call is not supported
[ "ErrAPINotSupported", "-", "API", "not", "supported", "response", "The", "specified", "API", "call", "is", "not", "supported" ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L275-L282
26,708
minio/minio-go
pkg/s3signer/request-signature-v2.go
encodeURL2Path
func encodeURL2Path(req *http.Request, virtualHost bool) (path string) { if virtualHost { reqHost := getHostAddr(req) dotPos := strings.Index(reqHost, ".") if dotPos > -1 { bucketName := reqHost[:dotPos] path = "/" + bucketName path += req.URL.Path path = s3utils.EncodePath(path) return } } pa...
go
func encodeURL2Path(req *http.Request, virtualHost bool) (path string) { if virtualHost { reqHost := getHostAddr(req) dotPos := strings.Index(reqHost, ".") if dotPos > -1 { bucketName := reqHost[:dotPos] path = "/" + bucketName path += req.URL.Path path = s3utils.EncodePath(path) return } } pa...
[ "func", "encodeURL2Path", "(", "req", "*", "http", ".", "Request", ",", "virtualHost", "bool", ")", "(", "path", "string", ")", "{", "if", "virtualHost", "{", "reqHost", ":=", "getHostAddr", "(", "req", ")", "\n", "dotPos", ":=", "strings", ".", "Index",...
// Encode input URL path to URL encoded path.
[ "Encode", "input", "URL", "path", "to", "URL", "encoded", "path", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-v2.go#L42-L56
26,709
minio/minio-go
pkg/s3signer/request-signature-v2.go
PostPresignSignatureV2
func PostPresignSignatureV2(policyBase64, secretAccessKey string) string { hm := hmac.New(sha1.New, []byte(secretAccessKey)) hm.Write([]byte(policyBase64)) signature := base64.StdEncoding.EncodeToString(hm.Sum(nil)) return signature }
go
func PostPresignSignatureV2(policyBase64, secretAccessKey string) string { hm := hmac.New(sha1.New, []byte(secretAccessKey)) hm.Write([]byte(policyBase64)) signature := base64.StdEncoding.EncodeToString(hm.Sum(nil)) return signature }
[ "func", "PostPresignSignatureV2", "(", "policyBase64", ",", "secretAccessKey", "string", ")", "string", "{", "hm", ":=", "hmac", ".", "New", "(", "sha1", ".", "New", ",", "[", "]", "byte", "(", "secretAccessKey", ")", ")", "\n", "hm", ".", "Write", "(", ...
// PostPresignSignatureV2 - presigned signature for PostPolicy // request.
[ "PostPresignSignatureV2", "-", "presigned", "signature", "for", "PostPolicy", "request", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-v2.go#L106-L111
26,710
minio/minio-go
pkg/s3signer/request-signature-v2.go
writeSignV2Headers
func writeSignV2Headers(buf *bytes.Buffer, req http.Request) { buf.WriteString(req.Method + "\n") buf.WriteString(req.Header.Get("Content-Md5") + "\n") buf.WriteString(req.Header.Get("Content-Type") + "\n") buf.WriteString(req.Header.Get("Date") + "\n") }
go
func writeSignV2Headers(buf *bytes.Buffer, req http.Request) { buf.WriteString(req.Method + "\n") buf.WriteString(req.Header.Get("Content-Md5") + "\n") buf.WriteString(req.Header.Get("Content-Type") + "\n") buf.WriteString(req.Header.Get("Date") + "\n") }
[ "func", "writeSignV2Headers", "(", "buf", "*", "bytes", ".", "Buffer", ",", "req", "http", ".", "Request", ")", "{", "buf", ".", "WriteString", "(", "req", ".", "Method", "+", "\"", "\\n", "\"", ")", "\n", "buf", ".", "WriteString", "(", "req", ".", ...
// writeSignV2Headers - write signV2 required headers.
[ "writeSignV2Headers", "-", "write", "signV2", "required", "headers", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-v2.go#L209-L214
26,711
minio/minio-go
pkg/s3signer/request-signature-v2.go
writeCanonicalizedHeaders
func writeCanonicalizedHeaders(buf *bytes.Buffer, req http.Request) { var protoHeaders []string vals := make(map[string][]string) for k, vv := range req.Header { // All the AMZ headers should be lowercase lk := strings.ToLower(k) if strings.HasPrefix(lk, "x-amz") { protoHeaders = append(protoHeaders, lk) ...
go
func writeCanonicalizedHeaders(buf *bytes.Buffer, req http.Request) { var protoHeaders []string vals := make(map[string][]string) for k, vv := range req.Header { // All the AMZ headers should be lowercase lk := strings.ToLower(k) if strings.HasPrefix(lk, "x-amz") { protoHeaders = append(protoHeaders, lk) ...
[ "func", "writeCanonicalizedHeaders", "(", "buf", "*", "bytes", ".", "Buffer", ",", "req", "http", ".", "Request", ")", "{", "var", "protoHeaders", "[", "]", "string", "\n", "vals", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "string", ")", ...
// writeCanonicalizedHeaders - write canonicalized headers.
[ "writeCanonicalizedHeaders", "-", "write", "canonicalized", "headers", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-v2.go#L217-L249
26,712
minio/minio-go
pkg/credentials/sts_client_grants.go
NewSTSClientGrants
func NewSTSClientGrants(stsEndpoint string, getClientGrantsTokenExpiry func() (*ClientGrantsToken, error)) (*Credentials, error) { if stsEndpoint == "" { return nil, errors.New("STS endpoint cannot be empty") } if getClientGrantsTokenExpiry == nil { return nil, errors.New("Client grants access token and expiry r...
go
func NewSTSClientGrants(stsEndpoint string, getClientGrantsTokenExpiry func() (*ClientGrantsToken, error)) (*Credentials, error) { if stsEndpoint == "" { return nil, errors.New("STS endpoint cannot be empty") } if getClientGrantsTokenExpiry == nil { return nil, errors.New("Client grants access token and expiry r...
[ "func", "NewSTSClientGrants", "(", "stsEndpoint", "string", ",", "getClientGrantsTokenExpiry", "func", "(", ")", "(", "*", "ClientGrantsToken", ",", "error", ")", ")", "(", "*", "Credentials", ",", "error", ")", "{", "if", "stsEndpoint", "==", "\"", "\"", "{...
// NewSTSClientGrants returns a pointer to a new // Credentials object wrapping the STSClientGrants.
[ "NewSTSClientGrants", "returns", "a", "pointer", "to", "a", "new", "Credentials", "object", "wrapping", "the", "STSClientGrants", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/credentials/sts_client_grants.go#L89-L103
26,713
minio/minio-go
api-remove.go
RemoveObject
func (c Client) RemoveObject(bucketName, objectName string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Execute DELETE on objectName. resp, err := c.executeMethod(co...
go
func (c Client) RemoveObject(bucketName, objectName string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Execute DELETE on objectName. resp, err := c.executeMethod(co...
[ "func", "(", "c", "Client", ")", "RemoveObject", "(", "bucketName", ",", "objectName", "string", ")", "error", "{", "// Input validation.", "if", "err", ":=", "s3utils", ".", "CheckValidBucketName", "(", "bucketName", ")", ";", "err", "!=", "nil", "{", "retu...
// RemoveObject remove an object from a bucket.
[ "RemoveObject", "remove", "an", "object", "from", "a", "bucket", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L62-L91
26,714
minio/minio-go
api-remove.go
generateRemoveMultiObjectsRequest
func generateRemoveMultiObjectsRequest(objects []string) []byte { rmObjects := []deleteObject{} for _, obj := range objects { rmObjects = append(rmObjects, deleteObject{Key: obj}) } xmlBytes, _ := xml.Marshal(deleteMultiObjects{Objects: rmObjects, Quiet: true}) return xmlBytes }
go
func generateRemoveMultiObjectsRequest(objects []string) []byte { rmObjects := []deleteObject{} for _, obj := range objects { rmObjects = append(rmObjects, deleteObject{Key: obj}) } xmlBytes, _ := xml.Marshal(deleteMultiObjects{Objects: rmObjects, Quiet: true}) return xmlBytes }
[ "func", "generateRemoveMultiObjectsRequest", "(", "objects", "[", "]", "string", ")", "[", "]", "byte", "{", "rmObjects", ":=", "[", "]", "deleteObject", "{", "}", "\n", "for", "_", ",", "obj", ":=", "range", "objects", "{", "rmObjects", "=", "append", "...
// generateRemoveMultiObjects - generate the XML request for remove multi objects request
[ "generateRemoveMultiObjects", "-", "generate", "the", "XML", "request", "for", "remove", "multi", "objects", "request" ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L100-L107
26,715
minio/minio-go
api-remove.go
RemoveObjectsWithContext
func (c Client) RemoveObjectsWithContext(ctx context.Context, bucketName string, objectsCh <-chan string) <-chan RemoveObjectError { errorCh := make(chan RemoveObjectError, 1) // Validate if bucket name is valid. if err := s3utils.CheckValidBucketName(bucketName); err != nil { defer close(errorCh) errorCh <- Re...
go
func (c Client) RemoveObjectsWithContext(ctx context.Context, bucketName string, objectsCh <-chan string) <-chan RemoveObjectError { errorCh := make(chan RemoveObjectError, 1) // Validate if bucket name is valid. if err := s3utils.CheckValidBucketName(bucketName); err != nil { defer close(errorCh) errorCh <- Re...
[ "func", "(", "c", "Client", ")", "RemoveObjectsWithContext", "(", "ctx", "context", ".", "Context", ",", "bucketName", "string", ",", "objectsCh", "<-", "chan", "string", ")", "<-", "chan", "RemoveObjectError", "{", "errorCh", ":=", "make", "(", "chan", "Rem...
// RemoveObjectsWithContext - Identical to RemoveObjects call, but accepts context to facilitate request cancellation.
[ "RemoveObjectsWithContext", "-", "Identical", "to", "RemoveObjects", "call", "but", "accepts", "context", "to", "facilitate", "request", "cancellation", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L133-L218
26,716
minio/minio-go
api-remove.go
RemoveObjects
func (c Client) RemoveObjects(bucketName string, objectsCh <-chan string) <-chan RemoveObjectError { return c.RemoveObjectsWithContext(context.Background(), bucketName, objectsCh) }
go
func (c Client) RemoveObjects(bucketName string, objectsCh <-chan string) <-chan RemoveObjectError { return c.RemoveObjectsWithContext(context.Background(), bucketName, objectsCh) }
[ "func", "(", "c", "Client", ")", "RemoveObjects", "(", "bucketName", "string", ",", "objectsCh", "<-", "chan", "string", ")", "<-", "chan", "RemoveObjectError", "{", "return", "c", ".", "RemoveObjectsWithContext", "(", "context", ".", "Background", "(", ")", ...
// RemoveObjects removes multiple objects from a bucket. // The list of objects to remove are received from objectsCh. // Remove failures are sent back via error channel.
[ "RemoveObjects", "removes", "multiple", "objects", "from", "a", "bucket", ".", "The", "list", "of", "objects", "to", "remove", "are", "received", "from", "objectsCh", ".", "Remove", "failures", "are", "sent", "back", "via", "error", "channel", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L223-L225
26,717
minio/minio-go
api-remove.go
RemoveIncompleteUpload
func (c Client) RemoveIncompleteUpload(bucketName, objectName string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Find multipart upload ids of the object to be aborte...
go
func (c Client) RemoveIncompleteUpload(bucketName, objectName string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Find multipart upload ids of the object to be aborte...
[ "func", "(", "c", "Client", ")", "RemoveIncompleteUpload", "(", "bucketName", ",", "objectName", "string", ")", "error", "{", "// Input validation.", "if", "err", ":=", "s3utils", ".", "CheckValidBucketName", "(", "bucketName", ")", ";", "err", "!=", "nil", "{...
// RemoveIncompleteUpload aborts an partially uploaded object.
[ "RemoveIncompleteUpload", "aborts", "an", "partially", "uploaded", "object", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L228-L251
26,718
minio/minio-go
api-remove.go
abortMultipartUpload
func (c Client) abortMultipartUpload(ctx context.Context, bucketName, objectName, uploadID string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Initialize url queries...
go
func (c Client) abortMultipartUpload(ctx context.Context, bucketName, objectName, uploadID string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Initialize url queries...
[ "func", "(", "c", "Client", ")", "abortMultipartUpload", "(", "ctx", "context", ".", "Context", ",", "bucketName", ",", "objectName", ",", "uploadID", "string", ")", "error", "{", "// Input validation.", "if", "err", ":=", "s3utils", ".", "CheckValidBucketName",...
// abortMultipartUpload aborts a multipart upload for the given // uploadID, all previously uploaded parts are deleted.
[ "abortMultipartUpload", "aborts", "a", "multipart", "upload", "for", "the", "given", "uploadID", "all", "previously", "uploaded", "parts", "are", "deleted", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L255-L303
26,719
minio/minio-go
hook-reader.go
newHook
func newHook(source, hook io.Reader) io.Reader { if hook == nil { return source } return &hookReader{source, hook} }
go
func newHook(source, hook io.Reader) io.Reader { if hook == nil { return source } return &hookReader{source, hook} }
[ "func", "newHook", "(", "source", ",", "hook", "io", ".", "Reader", ")", "io", ".", "Reader", "{", "if", "hook", "==", "nil", "{", "return", "source", "\n", "}", "\n", "return", "&", "hookReader", "{", "source", ",", "hook", "}", "\n", "}" ]
// newHook returns a io.ReadSeeker which implements hookReader that // reports the data read from the source to the hook.
[ "newHook", "returns", "a", "io", ".", "ReadSeeker", "which", "implements", "hookReader", "that", "reports", "the", "data", "read", "from", "the", "source", "to", "the", "hook", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/hook-reader.go#L80-L85
26,720
minio/minio-go
post-policy.go
NewPostPolicy
func NewPostPolicy() *PostPolicy { p := &PostPolicy{} p.conditions = make([]policyCondition, 0) p.formData = make(map[string]string) return p }
go
func NewPostPolicy() *PostPolicy { p := &PostPolicy{} p.conditions = make([]policyCondition, 0) p.formData = make(map[string]string) return p }
[ "func", "NewPostPolicy", "(", ")", "*", "PostPolicy", "{", "p", ":=", "&", "PostPolicy", "{", "}", "\n", "p", ".", "conditions", "=", "make", "(", "[", "]", "policyCondition", ",", "0", ")", "\n", "p", ".", "formData", "=", "make", "(", "map", "[",...
// NewPostPolicy - Instantiate new post policy.
[ "NewPostPolicy", "-", "Instantiate", "new", "post", "policy", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L66-L71
26,721
minio/minio-go
post-policy.go
SetExpires
func (p *PostPolicy) SetExpires(t time.Time) error { if t.IsZero() { return ErrInvalidArgument("No expiry time set.") } p.expiration = t return nil }
go
func (p *PostPolicy) SetExpires(t time.Time) error { if t.IsZero() { return ErrInvalidArgument("No expiry time set.") } p.expiration = t return nil }
[ "func", "(", "p", "*", "PostPolicy", ")", "SetExpires", "(", "t", "time", ".", "Time", ")", "error", "{", "if", "t", ".", "IsZero", "(", ")", "{", "return", "ErrInvalidArgument", "(", "\"", "\"", ")", "\n", "}", "\n", "p", ".", "expiration", "=", ...
// SetExpires - Sets expiration time for the new policy.
[ "SetExpires", "-", "Sets", "expiration", "time", "for", "the", "new", "policy", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L74-L80
26,722
minio/minio-go
post-policy.go
SetKey
func (p *PostPolicy) SetKey(key string) error { if strings.TrimSpace(key) == "" || key == "" { return ErrInvalidArgument("Object name is empty.") } policyCond := policyCondition{ matchType: "eq", condition: "$key", value: key, } if err := p.addNewPolicy(policyCond); err != nil { return err } p.form...
go
func (p *PostPolicy) SetKey(key string) error { if strings.TrimSpace(key) == "" || key == "" { return ErrInvalidArgument("Object name is empty.") } policyCond := policyCondition{ matchType: "eq", condition: "$key", value: key, } if err := p.addNewPolicy(policyCond); err != nil { return err } p.form...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetKey", "(", "key", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "key", ")", "==", "\"", "\"", "||", "key", "==", "\"", "\"", "{", "return", "ErrInvalidArgument", "(", "\"", "\"", ...
// SetKey - Sets an object name for the policy based upload.
[ "SetKey", "-", "Sets", "an", "object", "name", "for", "the", "policy", "based", "upload", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L83-L97
26,723
minio/minio-go
post-policy.go
SetKeyStartsWith
func (p *PostPolicy) SetKeyStartsWith(keyStartsWith string) error { if strings.TrimSpace(keyStartsWith) == "" || keyStartsWith == "" { return ErrInvalidArgument("Object prefix is empty.") } policyCond := policyCondition{ matchType: "starts-with", condition: "$key", value: keyStartsWith, } if err := p.a...
go
func (p *PostPolicy) SetKeyStartsWith(keyStartsWith string) error { if strings.TrimSpace(keyStartsWith) == "" || keyStartsWith == "" { return ErrInvalidArgument("Object prefix is empty.") } policyCond := policyCondition{ matchType: "starts-with", condition: "$key", value: keyStartsWith, } if err := p.a...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetKeyStartsWith", "(", "keyStartsWith", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "keyStartsWith", ")", "==", "\"", "\"", "||", "keyStartsWith", "==", "\"", "\"", "{", "return", "ErrInv...
// SetKeyStartsWith - Sets an object name that an policy based upload // can start with.
[ "SetKeyStartsWith", "-", "Sets", "an", "object", "name", "that", "an", "policy", "based", "upload", "can", "start", "with", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L101-L115
26,724
minio/minio-go
post-policy.go
SetBucket
func (p *PostPolicy) SetBucket(bucketName string) error { if strings.TrimSpace(bucketName) == "" || bucketName == "" { return ErrInvalidArgument("Bucket name is empty.") } policyCond := policyCondition{ matchType: "eq", condition: "$bucket", value: bucketName, } if err := p.addNewPolicy(policyCond); er...
go
func (p *PostPolicy) SetBucket(bucketName string) error { if strings.TrimSpace(bucketName) == "" || bucketName == "" { return ErrInvalidArgument("Bucket name is empty.") } policyCond := policyCondition{ matchType: "eq", condition: "$bucket", value: bucketName, } if err := p.addNewPolicy(policyCond); er...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetBucket", "(", "bucketName", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "bucketName", ")", "==", "\"", "\"", "||", "bucketName", "==", "\"", "\"", "{", "return", "ErrInvalidArgument", ...
// SetBucket - Sets bucket at which objects will be uploaded to.
[ "SetBucket", "-", "Sets", "bucket", "at", "which", "objects", "will", "be", "uploaded", "to", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L118-L132
26,725
minio/minio-go
post-policy.go
SetContentType
func (p *PostPolicy) SetContentType(contentType string) error { if strings.TrimSpace(contentType) == "" || contentType == "" { return ErrInvalidArgument("No content type specified.") } policyCond := policyCondition{ matchType: "eq", condition: "$Content-Type", value: contentType, } if err := p.addNewPo...
go
func (p *PostPolicy) SetContentType(contentType string) error { if strings.TrimSpace(contentType) == "" || contentType == "" { return ErrInvalidArgument("No content type specified.") } policyCond := policyCondition{ matchType: "eq", condition: "$Content-Type", value: contentType, } if err := p.addNewPo...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetContentType", "(", "contentType", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "contentType", ")", "==", "\"", "\"", "||", "contentType", "==", "\"", "\"", "{", "return", "ErrInvalidArgu...
// SetContentType - Sets content-type of the object for this policy // based upload.
[ "SetContentType", "-", "Sets", "content", "-", "type", "of", "the", "object", "for", "this", "policy", "based", "upload", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L136-L150
26,726
minio/minio-go
post-policy.go
SetContentLengthRange
func (p *PostPolicy) SetContentLengthRange(min, max int64) error { if min > max { return ErrInvalidArgument("Minimum limit is larger than maximum limit.") } if min < 0 { return ErrInvalidArgument("Minimum limit cannot be negative.") } if max < 0 { return ErrInvalidArgument("Maximum limit cannot be negative."...
go
func (p *PostPolicy) SetContentLengthRange(min, max int64) error { if min > max { return ErrInvalidArgument("Minimum limit is larger than maximum limit.") } if min < 0 { return ErrInvalidArgument("Minimum limit cannot be negative.") } if max < 0 { return ErrInvalidArgument("Maximum limit cannot be negative."...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetContentLengthRange", "(", "min", ",", "max", "int64", ")", "error", "{", "if", "min", ">", "max", "{", "return", "ErrInvalidArgument", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "min", "<", "0", "{", ...
// SetContentLengthRange - Set new min and max content length // condition for all incoming uploads.
[ "SetContentLengthRange", "-", "Set", "new", "min", "and", "max", "content", "length", "condition", "for", "all", "incoming", "uploads", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L154-L167
26,727
minio/minio-go
post-policy.go
SetSuccessStatusAction
func (p *PostPolicy) SetSuccessStatusAction(status string) error { if strings.TrimSpace(status) == "" || status == "" { return ErrInvalidArgument("Status is empty") } policyCond := policyCondition{ matchType: "eq", condition: "$success_action_status", value: status, } if err := p.addNewPolicy(policyCon...
go
func (p *PostPolicy) SetSuccessStatusAction(status string) error { if strings.TrimSpace(status) == "" || status == "" { return ErrInvalidArgument("Status is empty") } policyCond := policyCondition{ matchType: "eq", condition: "$success_action_status", value: status, } if err := p.addNewPolicy(policyCon...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetSuccessStatusAction", "(", "status", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "status", ")", "==", "\"", "\"", "||", "status", "==", "\"", "\"", "{", "return", "ErrInvalidArgument", ...
// SetSuccessStatusAction - Sets the status success code of the object for this policy // based upload.
[ "SetSuccessStatusAction", "-", "Sets", "the", "status", "success", "code", "of", "the", "object", "for", "this", "policy", "based", "upload", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L171-L185
26,728
minio/minio-go
post-policy.go
addNewPolicy
func (p *PostPolicy) addNewPolicy(policyCond policyCondition) error { if policyCond.matchType == "" || policyCond.condition == "" || policyCond.value == "" { return ErrInvalidArgument("Policy fields are empty.") } p.conditions = append(p.conditions, policyCond) return nil }
go
func (p *PostPolicy) addNewPolicy(policyCond policyCondition) error { if policyCond.matchType == "" || policyCond.condition == "" || policyCond.value == "" { return ErrInvalidArgument("Policy fields are empty.") } p.conditions = append(p.conditions, policyCond) return nil }
[ "func", "(", "p", "*", "PostPolicy", ")", "addNewPolicy", "(", "policyCond", "policyCondition", ")", "error", "{", "if", "policyCond", ".", "matchType", "==", "\"", "\"", "||", "policyCond", ".", "condition", "==", "\"", "\"", "||", "policyCond", ".", "val...
// addNewPolicy - internal helper to validate adding new policies.
[ "addNewPolicy", "-", "internal", "helper", "to", "validate", "adding", "new", "policies", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L232-L238
26,729
minio/minio-go
post-policy.go
marshalJSON
func (p PostPolicy) marshalJSON() []byte { expirationStr := `"expiration":"` + p.expiration.Format(expirationDateFormat) + `"` var conditionsStr string conditions := []string{} for _, po := range p.conditions { conditions = append(conditions, fmt.Sprintf("[\"%s\",\"%s\",\"%s\"]", po.matchType, po.condition, po.va...
go
func (p PostPolicy) marshalJSON() []byte { expirationStr := `"expiration":"` + p.expiration.Format(expirationDateFormat) + `"` var conditionsStr string conditions := []string{} for _, po := range p.conditions { conditions = append(conditions, fmt.Sprintf("[\"%s\",\"%s\",\"%s\"]", po.matchType, po.condition, po.va...
[ "func", "(", "p", "PostPolicy", ")", "marshalJSON", "(", ")", "[", "]", "byte", "{", "expirationStr", ":=", "`\"expiration\":\"`", "+", "p", ".", "expiration", ".", "Format", "(", "expirationDateFormat", ")", "+", "`\"`", "\n", "var", "conditionsStr", "strin...
// marshalJSON - Provides Marshalled JSON in bytes.
[ "marshalJSON", "-", "Provides", "Marshalled", "JSON", "in", "bytes", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L246-L265
26,730
minio/minio-go
pkg/policy/bucket-policy.go
IsValidBucketPolicy
func (p BucketPolicy) IsValidBucketPolicy() bool { switch p { case BucketPolicyNone, BucketPolicyReadOnly, BucketPolicyReadWrite, BucketPolicyWriteOnly: return true } return false }
go
func (p BucketPolicy) IsValidBucketPolicy() bool { switch p { case BucketPolicyNone, BucketPolicyReadOnly, BucketPolicyReadWrite, BucketPolicyWriteOnly: return true } return false }
[ "func", "(", "p", "BucketPolicy", ")", "IsValidBucketPolicy", "(", ")", "bool", "{", "switch", "p", "{", "case", "BucketPolicyNone", ",", "BucketPolicyReadOnly", ",", "BucketPolicyReadWrite", ",", "BucketPolicyWriteOnly", ":", "return", "true", "\n", "}", "\n", ...
// IsValidBucketPolicy - returns true if policy is valid and supported, false otherwise.
[ "IsValidBucketPolicy", "-", "returns", "true", "if", "policy", "is", "valid", "and", "supported", "false", "otherwise", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L41-L47
26,731
minio/minio-go
pkg/policy/bucket-policy.go
UnmarshalJSON
func (u *User) UnmarshalJSON(data []byte) error { // Try to unmarshal data in a struct equal to User, we need it // to avoid infinite recursive call of this function type AliasUser User var au AliasUser err := json.Unmarshal(data, &au) if err == nil { *u = User(au) return nil } // Data type is not known, ch...
go
func (u *User) UnmarshalJSON(data []byte) error { // Try to unmarshal data in a struct equal to User, we need it // to avoid infinite recursive call of this function type AliasUser User var au AliasUser err := json.Unmarshal(data, &au) if err == nil { *u = User(au) return nil } // Data type is not known, ch...
[ "func", "(", "u", "*", "User", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "// Try to unmarshal data in a struct equal to User, we need it", "// to avoid infinite recursive call of this function", "type", "AliasUser", "User", "\n", "var", "au",...
// UnmarshalJSON is a custom json unmarshaler for Principal field, // the reason is that Principal can take a json struct represented by // User string but it can also take a string.
[ "UnmarshalJSON", "is", "a", "custom", "json", "unmarshaler", "for", "Principal", "field", "the", "reason", "is", "that", "Principal", "can", "take", "a", "json", "struct", "represented", "by", "User", "string", "but", "it", "can", "also", "take", "a", "strin...
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L90-L112
26,732
minio/minio-go
pkg/policy/bucket-policy.go
isValidStatement
func isValidStatement(statement Statement, bucketName string) bool { if statement.Actions.Intersection(validActions).IsEmpty() { return false } if statement.Effect != "Allow" { return false } if statement.Principal.AWS == nil || !statement.Principal.AWS.Contains("*") { return false } bucketResource := a...
go
func isValidStatement(statement Statement, bucketName string) bool { if statement.Actions.Intersection(validActions).IsEmpty() { return false } if statement.Effect != "Allow" { return false } if statement.Principal.AWS == nil || !statement.Principal.AWS.Contains("*") { return false } bucketResource := a...
[ "func", "isValidStatement", "(", "statement", "Statement", ",", "bucketName", "string", ")", "bool", "{", "if", "statement", ".", "Actions", ".", "Intersection", "(", "validActions", ")", ".", "IsEmpty", "(", ")", "{", "return", "false", "\n", "}", "\n\n", ...
// isValidStatement - returns whether given statement is valid to process for given bucket name.
[ "isValidStatement", "-", "returns", "whether", "given", "statement", "is", "valid", "to", "process", "for", "given", "bucket", "name", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L131-L154
26,733
minio/minio-go
pkg/policy/bucket-policy.go
newBucketStatement
func newBucketStatement(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} if policy == BucketPolicyNone || bucketName == "" { return statements } bucketResource := set.CreateStringSet(awsResourcePrefix + bucketName) statement := Statement{ Actions: ...
go
func newBucketStatement(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} if policy == BucketPolicyNone || bucketName == "" { return statements } bucketResource := set.CreateStringSet(awsResourcePrefix + bucketName) statement := Statement{ Actions: ...
[ "func", "newBucketStatement", "(", "policy", "BucketPolicy", ",", "bucketName", "string", ",", "prefix", "string", ")", "(", "statements", "[", "]", "Statement", ")", "{", "statements", "=", "[", "]", "Statement", "{", "}", "\n", "if", "policy", "==", "Buc...
// Returns new statements with bucket actions for given policy.
[ "Returns", "new", "statements", "with", "bucket", "actions", "for", "given", "policy", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L157-L204
26,734
minio/minio-go
pkg/policy/bucket-policy.go
newObjectStatement
func newObjectStatement(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} if policy == BucketPolicyNone || bucketName == "" { return statements } statement := Statement{ Effect: "Allow", Principal: User{AWS: set.CreateStringSet("*")}, Resources:...
go
func newObjectStatement(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} if policy == BucketPolicyNone || bucketName == "" { return statements } statement := Statement{ Effect: "Allow", Principal: User{AWS: set.CreateStringSet("*")}, Resources:...
[ "func", "newObjectStatement", "(", "policy", "BucketPolicy", ",", "bucketName", "string", ",", "prefix", "string", ")", "(", "statements", "[", "]", "Statement", ")", "{", "statements", "=", "[", "]", "Statement", "{", "}", "\n", "if", "policy", "==", "Buc...
// Returns new statements contains object actions for given policy.
[ "Returns", "new", "statements", "contains", "object", "actions", "for", "given", "policy", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L207-L230
26,735
minio/minio-go
pkg/policy/bucket-policy.go
newStatements
func newStatements(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} ns := newBucketStatement(policy, bucketName, prefix) statements = append(statements, ns...) ns = newObjectStatement(policy, bucketName, prefix) statements = append(statements, ns...) r...
go
func newStatements(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} ns := newBucketStatement(policy, bucketName, prefix) statements = append(statements, ns...) ns = newObjectStatement(policy, bucketName, prefix) statements = append(statements, ns...) r...
[ "func", "newStatements", "(", "policy", "BucketPolicy", ",", "bucketName", "string", ",", "prefix", "string", ")", "(", "statements", "[", "]", "Statement", ")", "{", "statements", "=", "[", "]", "Statement", "{", "}", "\n", "ns", ":=", "newBucketStatement",...
// Returns new statements for given policy, bucket and prefix.
[ "Returns", "new", "statements", "for", "given", "policy", "bucket", "and", "prefix", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L233-L242
26,736
minio/minio-go
pkg/policy/bucket-policy.go
getInUsePolicy
func getInUsePolicy(statements []Statement, bucketName string, prefix string) (readOnlyInUse, writeOnlyInUse bool) { resourcePrefix := awsResourcePrefix + bucketName + "/" objectResource := awsResourcePrefix + bucketName + "/" + prefix + "*" for _, s := range statements { if !s.Resources.Contains(objectResource) ...
go
func getInUsePolicy(statements []Statement, bucketName string, prefix string) (readOnlyInUse, writeOnlyInUse bool) { resourcePrefix := awsResourcePrefix + bucketName + "/" objectResource := awsResourcePrefix + bucketName + "/" + prefix + "*" for _, s := range statements { if !s.Resources.Contains(objectResource) ...
[ "func", "getInUsePolicy", "(", "statements", "[", "]", "Statement", ",", "bucketName", "string", ",", "prefix", "string", ")", "(", "readOnlyInUse", ",", "writeOnlyInUse", "bool", ")", "{", "resourcePrefix", ":=", "awsResourcePrefix", "+", "bucketName", "+", "\"...
// Returns whether given bucket statements are used by other than given prefix statements.
[ "Returns", "whether", "given", "bucket", "statements", "are", "used", "by", "other", "than", "given", "prefix", "statements", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L245-L265
26,737
minio/minio-go
pkg/policy/bucket-policy.go
removeObjectActions
func removeObjectActions(statement Statement, objectResource string) Statement { if statement.Conditions == nil { if len(statement.Resources) > 1 { statement.Resources.Remove(objectResource) } else { statement.Actions = statement.Actions.Difference(readOnlyObjectActions) statement.Actions = statement.Acti...
go
func removeObjectActions(statement Statement, objectResource string) Statement { if statement.Conditions == nil { if len(statement.Resources) > 1 { statement.Resources.Remove(objectResource) } else { statement.Actions = statement.Actions.Difference(readOnlyObjectActions) statement.Actions = statement.Acti...
[ "func", "removeObjectActions", "(", "statement", "Statement", ",", "objectResource", "string", ")", "Statement", "{", "if", "statement", ".", "Conditions", "==", "nil", "{", "if", "len", "(", "statement", ".", "Resources", ")", ">", "1", "{", "statement", "....
// Removes object actions in given statement.
[ "Removes", "object", "actions", "in", "given", "statement", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L268-L279
26,738
minio/minio-go
pkg/policy/bucket-policy.go
removeBucketActions
func removeBucketActions(statement Statement, prefix string, bucketResource string, readOnlyInUse, writeOnlyInUse bool) Statement { removeReadOnly := func() { if !statement.Actions.Intersection(readOnlyBucketActions).Equals(readOnlyBucketActions) { return } if statement.Conditions == nil { statement.Actio...
go
func removeBucketActions(statement Statement, prefix string, bucketResource string, readOnlyInUse, writeOnlyInUse bool) Statement { removeReadOnly := func() { if !statement.Actions.Intersection(readOnlyBucketActions).Equals(readOnlyBucketActions) { return } if statement.Conditions == nil { statement.Actio...
[ "func", "removeBucketActions", "(", "statement", "Statement", ",", "prefix", "string", ",", "bucketResource", "string", ",", "readOnlyInUse", ",", "writeOnlyInUse", "bool", ")", "Statement", "{", "removeReadOnly", ":=", "func", "(", ")", "{", "if", "!", "stateme...
// Removes bucket actions for given policy in given statement.
[ "Removes", "bucket", "actions", "for", "given", "policy", "in", "given", "statement", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L282-L340
26,739
minio/minio-go
pkg/policy/bucket-policy.go
appendStatement
func appendStatement(statements []Statement, statement Statement) []Statement { for i, s := range statements { if s.Actions.Equals(statement.Actions) && s.Effect == statement.Effect && s.Principal.AWS.Equals(statement.Principal.AWS) && reflect.DeepEqual(s.Conditions, statement.Conditions) { statements[i]...
go
func appendStatement(statements []Statement, statement Statement) []Statement { for i, s := range statements { if s.Actions.Equals(statement.Actions) && s.Effect == statement.Effect && s.Principal.AWS.Equals(statement.Principal.AWS) && reflect.DeepEqual(s.Conditions, statement.Conditions) { statements[i]...
[ "func", "appendStatement", "(", "statements", "[", "]", "Statement", ",", "statement", "Statement", ")", "[", "]", "Statement", "{", "for", "i", ",", "s", ":=", "range", "statements", "{", "if", "s", ".", "Actions", ".", "Equals", "(", "statement", ".", ...
// Appends given statement into statement list to have unique statements. // - If statement already exists in statement list, it ignores. // - If statement exists with different conditions, they are merged. // - Else the statement is appended to statement list.
[ "Appends", "given", "statement", "into", "statement", "list", "to", "have", "unique", "statements", ".", "-", "If", "statement", "already", "exists", "in", "statement", "list", "it", "ignores", ".", "-", "If", "statement", "exists", "with", "different", "condi...
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L436-L473
26,740
minio/minio-go
pkg/policy/bucket-policy.go
appendStatements
func appendStatements(statements []Statement, appendStatements []Statement) []Statement { for _, s := range appendStatements { statements = appendStatement(statements, s) } return statements }
go
func appendStatements(statements []Statement, appendStatements []Statement) []Statement { for _, s := range appendStatements { statements = appendStatement(statements, s) } return statements }
[ "func", "appendStatements", "(", "statements", "[", "]", "Statement", ",", "appendStatements", "[", "]", "Statement", ")", "[", "]", "Statement", "{", "for", "_", ",", "s", ":=", "range", "appendStatements", "{", "statements", "=", "appendStatement", "(", "s...
// Appends two statement lists.
[ "Appends", "two", "statement", "lists", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L476-L482
26,741
minio/minio-go
pkg/policy/bucket-policy.go
getBucketPolicy
func getBucketPolicy(statement Statement, prefix string) (commonFound, readOnly, writeOnly bool) { if !(statement.Effect == "Allow" && statement.Principal.AWS.Contains("*")) { return commonFound, readOnly, writeOnly } if statement.Actions.Intersection(commonBucketActions).Equals(commonBucketActions) && statemen...
go
func getBucketPolicy(statement Statement, prefix string) (commonFound, readOnly, writeOnly bool) { if !(statement.Effect == "Allow" && statement.Principal.AWS.Contains("*")) { return commonFound, readOnly, writeOnly } if statement.Actions.Intersection(commonBucketActions).Equals(commonBucketActions) && statemen...
[ "func", "getBucketPolicy", "(", "statement", "Statement", ",", "prefix", "string", ")", "(", "commonFound", ",", "readOnly", ",", "writeOnly", "bool", ")", "{", "if", "!", "(", "statement", ".", "Effect", "==", "\"", "\"", "&&", "statement", ".", "Principa...
// Returns policy of given bucket statement.
[ "Returns", "policy", "of", "given", "bucket", "statement", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L485-L523
26,742
minio/minio-go
pkg/policy/bucket-policy.go
getObjectPolicy
func getObjectPolicy(statement Statement) (readOnly bool, writeOnly bool) { if statement.Effect == "Allow" && statement.Principal.AWS.Contains("*") && statement.Conditions == nil { if statement.Actions.Intersection(readOnlyObjectActions).Equals(readOnlyObjectActions) { readOnly = true } if statement.Actio...
go
func getObjectPolicy(statement Statement) (readOnly bool, writeOnly bool) { if statement.Effect == "Allow" && statement.Principal.AWS.Contains("*") && statement.Conditions == nil { if statement.Actions.Intersection(readOnlyObjectActions).Equals(readOnlyObjectActions) { readOnly = true } if statement.Actio...
[ "func", "getObjectPolicy", "(", "statement", "Statement", ")", "(", "readOnly", "bool", ",", "writeOnly", "bool", ")", "{", "if", "statement", ".", "Effect", "==", "\"", "\"", "&&", "statement", ".", "Principal", ".", "AWS", ".", "Contains", "(", "\"", "...
// Returns policy of given object statement.
[ "Returns", "policy", "of", "given", "object", "statement", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L526-L539
26,743
minio/minio-go
pkg/policy/bucket-policy.go
GetPolicy
func GetPolicy(statements []Statement, bucketName string, prefix string) BucketPolicy { bucketResource := awsResourcePrefix + bucketName objectResource := awsResourcePrefix + bucketName + "/" + prefix + "*" bucketCommonFound := false bucketReadOnly := false bucketWriteOnly := false matchedResource := "" objRead...
go
func GetPolicy(statements []Statement, bucketName string, prefix string) BucketPolicy { bucketResource := awsResourcePrefix + bucketName objectResource := awsResourcePrefix + bucketName + "/" + prefix + "*" bucketCommonFound := false bucketReadOnly := false bucketWriteOnly := false matchedResource := "" objRead...
[ "func", "GetPolicy", "(", "statements", "[", "]", "Statement", ",", "bucketName", "string", ",", "prefix", "string", ")", "BucketPolicy", "{", "bucketResource", ":=", "awsResourcePrefix", "+", "bucketName", "\n", "objectResource", ":=", "awsResourcePrefix", "+", "...
// GetPolicy - Returns policy of given bucket name, prefix in given statements.
[ "GetPolicy", "-", "Returns", "policy", "of", "given", "bucket", "name", "prefix", "in", "given", "statements", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L542-L594
26,744
minio/minio-go
pkg/policy/bucket-policy.go
GetPolicies
func GetPolicies(statements []Statement, bucketName, prefix string) map[string]BucketPolicy { policyRules := map[string]BucketPolicy{} objResources := set.NewStringSet() // Search all resources related to objects policy for _, s := range statements { for r := range s.Resources { if strings.HasPrefix(r, awsReso...
go
func GetPolicies(statements []Statement, bucketName, prefix string) map[string]BucketPolicy { policyRules := map[string]BucketPolicy{} objResources := set.NewStringSet() // Search all resources related to objects policy for _, s := range statements { for r := range s.Resources { if strings.HasPrefix(r, awsReso...
[ "func", "GetPolicies", "(", "statements", "[", "]", "Statement", ",", "bucketName", ",", "prefix", "string", ")", "map", "[", "string", "]", "BucketPolicy", "{", "policyRules", ":=", "map", "[", "string", "]", "BucketPolicy", "{", "}", "\n", "objResources", ...
// GetPolicies - returns a map of policies of given bucket name, prefix in given statements.
[ "GetPolicies", "-", "returns", "a", "map", "of", "policies", "of", "given", "bucket", "name", "prefix", "in", "given", "statements", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L597-L625
26,745
minio/minio-go
pkg/policy/bucket-policy.go
SetPolicy
func SetPolicy(statements []Statement, policy BucketPolicy, bucketName string, prefix string) []Statement { out := removeStatements(statements, bucketName, prefix) // fmt.Println("out = ") // printstatement(out) ns := newStatements(policy, bucketName, prefix) // fmt.Println("ns = ") // printstatement(ns) rv := ...
go
func SetPolicy(statements []Statement, policy BucketPolicy, bucketName string, prefix string) []Statement { out := removeStatements(statements, bucketName, prefix) // fmt.Println("out = ") // printstatement(out) ns := newStatements(policy, bucketName, prefix) // fmt.Println("ns = ") // printstatement(ns) rv := ...
[ "func", "SetPolicy", "(", "statements", "[", "]", "Statement", ",", "policy", "BucketPolicy", ",", "bucketName", "string", ",", "prefix", "string", ")", "[", "]", "Statement", "{", "out", ":=", "removeStatements", "(", "statements", ",", "bucketName", ",", "...
// SetPolicy - Returns new statements containing policy of given bucket name and prefix are appended.
[ "SetPolicy", "-", "Returns", "new", "statements", "containing", "policy", "of", "given", "bucket", "name", "and", "prefix", "are", "appended", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L628-L641
26,746
minio/minio-go
pkg/policy/bucket-policy.go
resourceMatch
func resourceMatch(pattern, resource string) bool { if pattern == "" { return resource == pattern } if pattern == "*" { return true } parts := strings.Split(pattern, "*") if len(parts) == 1 { return resource == pattern } tGlob := strings.HasSuffix(pattern, "*") end := len(parts) - 1 if !strings.HasPrefi...
go
func resourceMatch(pattern, resource string) bool { if pattern == "" { return resource == pattern } if pattern == "*" { return true } parts := strings.Split(pattern, "*") if len(parts) == 1 { return resource == pattern } tGlob := strings.HasSuffix(pattern, "*") end := len(parts) - 1 if !strings.HasPrefi...
[ "func", "resourceMatch", "(", "pattern", ",", "resource", "string", ")", "bool", "{", "if", "pattern", "==", "\"", "\"", "{", "return", "resource", "==", "pattern", "\n", "}", "\n", "if", "pattern", "==", "\"", "\"", "{", "return", "true", "\n", "}", ...
// Match function matches wild cards in 'pattern' for resource.
[ "Match", "function", "matches", "wild", "cards", "in", "pattern", "for", "resource", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L644-L668
26,747
minio/minio-go
api-put-object-context.go
PutObjectWithContext
func (c Client) PutObjectWithContext(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts PutObjectOptions) (n int64, err error) { err = opts.validate() if err != nil { return 0, err } return c.putObjectCommon(ctx, bucketName, objectName, reader, objectSize, opts) }
go
func (c Client) PutObjectWithContext(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts PutObjectOptions) (n int64, err error) { err = opts.validate() if err != nil { return 0, err } return c.putObjectCommon(ctx, bucketName, objectName, reader, objectSize, opts) }
[ "func", "(", "c", "Client", ")", "PutObjectWithContext", "(", "ctx", "context", ".", "Context", ",", "bucketName", ",", "objectName", "string", ",", "reader", "io", ".", "Reader", ",", "objectSize", "int64", ",", "opts", "PutObjectOptions", ")", "(", "n", ...
// PutObjectWithContext - Identical to PutObject call, but accepts context to facilitate request cancellation.
[ "PutObjectWithContext", "-", "Identical", "to", "PutObject", "call", "but", "accepts", "context", "to", "facilitate", "request", "cancellation", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object-context.go#L26-L33
26,748
minio/minio-go
api-get-object-context.go
GetObjectWithContext
func (c Client) GetObjectWithContext(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (*Object, error) { return c.getObjectWithContext(ctx, bucketName, objectName, opts) }
go
func (c Client) GetObjectWithContext(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (*Object, error) { return c.getObjectWithContext(ctx, bucketName, objectName, opts) }
[ "func", "(", "c", "Client", ")", "GetObjectWithContext", "(", "ctx", "context", ".", "Context", ",", "bucketName", ",", "objectName", "string", ",", "opts", "GetObjectOptions", ")", "(", "*", "Object", ",", "error", ")", "{", "return", "c", ".", "getObject...
// GetObjectWithContext - returns an seekable, readable object. // The options can be used to specify the GET request further.
[ "GetObjectWithContext", "-", "returns", "an", "seekable", "readable", "object", ".", "The", "options", "can", "be", "used", "to", "specify", "the", "GET", "request", "further", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-object-context.go#L24-L26
26,749
minio/minio-go
api-get-lifecycle.go
GetBucketLifecycle
func (c Client) GetBucketLifecycle(bucketName string) (string, error) { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return "", err } bucketLifecycle, err := c.getBucketLifecycle(bucketName) if err != nil { errResponse := ToErrorResponse(err) if errResponse.Code == "N...
go
func (c Client) GetBucketLifecycle(bucketName string) (string, error) { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return "", err } bucketLifecycle, err := c.getBucketLifecycle(bucketName) if err != nil { errResponse := ToErrorResponse(err) if errResponse.Code == "N...
[ "func", "(", "c", "Client", ")", "GetBucketLifecycle", "(", "bucketName", "string", ")", "(", "string", ",", "error", ")", "{", "// Input validation.", "if", "err", ":=", "s3utils", ".", "CheckValidBucketName", "(", "bucketName", ")", ";", "err", "!=", "nil"...
// GetBucketLifecycle - get bucket lifecycle.
[ "GetBucketLifecycle", "-", "get", "bucket", "lifecycle", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-lifecycle.go#L30-L44
26,750
minio/minio-go
api-get-lifecycle.go
getBucketLifecycle
func (c Client) getBucketLifecycle(bucketName string) (string, error) { // Get resources properly escaped and lined up before // using them in http request. urlValues := make(url.Values) urlValues.Set("lifecycle", "") // Execute GET on bucket to get lifecycle. resp, err := c.executeMethod(context.Background(), "...
go
func (c Client) getBucketLifecycle(bucketName string) (string, error) { // Get resources properly escaped and lined up before // using them in http request. urlValues := make(url.Values) urlValues.Set("lifecycle", "") // Execute GET on bucket to get lifecycle. resp, err := c.executeMethod(context.Background(), "...
[ "func", "(", "c", "Client", ")", "getBucketLifecycle", "(", "bucketName", "string", ")", "(", "string", ",", "error", ")", "{", "// Get resources properly escaped and lined up before", "// using them in http request.", "urlValues", ":=", "make", "(", "url", ".", "Valu...
// Request server for current bucket lifecycle.
[ "Request", "server", "for", "current", "bucket", "lifecycle", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-lifecycle.go#L47-L77
26,751
vsergeev/btckeygenie
btckey/btckey.go
derive
func (priv *PrivateKey) derive() (pub *PublicKey) { /* See Certicom's SEC1 3.2.1, pg.23 */ /* Derive public key from Q = d*G */ Q := secp256k1.ScalarBaseMult(priv.D) /* Check that Q is on the curve */ if !secp256k1.IsOnCurve(Q) { panic("Catastrophic math logic failure in public key derivation.") } priv.X = ...
go
func (priv *PrivateKey) derive() (pub *PublicKey) { /* See Certicom's SEC1 3.2.1, pg.23 */ /* Derive public key from Q = d*G */ Q := secp256k1.ScalarBaseMult(priv.D) /* Check that Q is on the curve */ if !secp256k1.IsOnCurve(Q) { panic("Catastrophic math logic failure in public key derivation.") } priv.X = ...
[ "func", "(", "priv", "*", "PrivateKey", ")", "derive", "(", ")", "(", "pub", "*", "PublicKey", ")", "{", "/* See Certicom's SEC1 3.2.1, pg.23 */", "/* Derive public key from Q = d*G */", "Q", ":=", "secp256k1", ".", "ScalarBaseMult", "(", "priv", ".", "D", ")", ...
// derive derives a Bitcoin public key from a Bitcoin private key.
[ "derive", "derives", "a", "Bitcoin", "public", "key", "from", "a", "Bitcoin", "private", "key", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L54-L69
26,752
vsergeev/btckeygenie
btckey/btckey.go
GenerateKey
func GenerateKey(rand io.Reader) (priv PrivateKey, err error) { /* See Certicom's SEC1 3.2.1, pg.23 */ /* See NSA's Suite B Implementer’s Guide to FIPS 186-3 (ECDSA) A.1.1, pg.18 */ /* Select private key d randomly from [1, n) */ /* Read N bit length random bytes + 64 extra bits */ b := make([]byte, secp256k1.N...
go
func GenerateKey(rand io.Reader) (priv PrivateKey, err error) { /* See Certicom's SEC1 3.2.1, pg.23 */ /* See NSA's Suite B Implementer’s Guide to FIPS 186-3 (ECDSA) A.1.1, pg.18 */ /* Select private key d randomly from [1, n) */ /* Read N bit length random bytes + 64 extra bits */ b := make([]byte, secp256k1.N...
[ "func", "GenerateKey", "(", "rand", "io", ".", "Reader", ")", "(", "priv", "PrivateKey", ",", "err", "error", ")", "{", "/* See Certicom's SEC1 3.2.1, pg.23 */", "/* See NSA's Suite B Implementer’s Guide to FIPS 186-3 (ECDSA) A.1.1, pg.18 */", "/* Select private key d randomly fr...
// GenerateKey generates a public and private key pair using random source rand.
[ "GenerateKey", "generates", "a", "public", "and", "private", "key", "pair", "using", "random", "source", "rand", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L72-L98
26,753
vsergeev/btckeygenie
btckey/btckey.go
b58decode
func b58decode(s string) (b []byte, err error) { /* See https://en.bitcoin.it/wiki/Base58Check_encoding */ const BITCOIN_BASE58_TABLE = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" /* Initialize */ x := big.NewInt(0) m := big.NewInt(58) /* Convert string to big int */ for i := 0; i < len(s); i...
go
func b58decode(s string) (b []byte, err error) { /* See https://en.bitcoin.it/wiki/Base58Check_encoding */ const BITCOIN_BASE58_TABLE = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" /* Initialize */ x := big.NewInt(0) m := big.NewInt(58) /* Convert string to big int */ for i := 0; i < len(s); i...
[ "func", "b58decode", "(", "s", "string", ")", "(", "b", "[", "]", "byte", ",", "err", "error", ")", "{", "/* See https://en.bitcoin.it/wiki/Base58Check_encoding */", "const", "BITCOIN_BASE58_TABLE", "=", "\"", "\"", "\n\n", "/* Initialize */", "x", ":=", "big", ...
// b58decode decodes a base-58 encoded string into a byte slice b.
[ "b58decode", "decodes", "a", "base", "-", "58", "encoded", "string", "into", "a", "byte", "slice", "b", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L131-L155
26,754
vsergeev/btckeygenie
btckey/btckey.go
b58checkdecode
func b58checkdecode(s string) (ver uint8, b []byte, err error) { /* Decode base58 string */ b, err = b58decode(s) if err != nil { return 0, nil, err } /* Add leading zero bytes */ for i := 0; i < len(s); i++ { if s[i] != '1' { break } b = append([]byte{0x00}, b...) } /* Verify checksum */ if len(b...
go
func b58checkdecode(s string) (ver uint8, b []byte, err error) { /* Decode base58 string */ b, err = b58decode(s) if err != nil { return 0, nil, err } /* Add leading zero bytes */ for i := 0; i < len(s); i++ { if s[i] != '1' { break } b = append([]byte{0x00}, b...) } /* Verify checksum */ if len(b...
[ "func", "b58checkdecode", "(", "s", "string", ")", "(", "ver", "uint8", ",", "b", "[", "]", "byte", ",", "err", "error", ")", "{", "/* Decode base58 string */", "b", ",", "err", "=", "b58decode", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", ...
// b58checkdecode decodes base-58 check encoded string s into a version ver and byte slice b.
[ "b58checkdecode", "decodes", "base", "-", "58", "check", "encoded", "string", "s", "into", "a", "version", "ver", "and", "byte", "slice", "b", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L197-L243
26,755
vsergeev/btckeygenie
btckey/btckey.go
ToBytes
func (priv *PrivateKey) ToBytes() (b []byte) { d := priv.D.Bytes() /* Pad D to 32 bytes */ padded_d := append(bytes.Repeat([]byte{0x00}, 32-len(d)), d...) return padded_d }
go
func (priv *PrivateKey) ToBytes() (b []byte) { d := priv.D.Bytes() /* Pad D to 32 bytes */ padded_d := append(bytes.Repeat([]byte{0x00}, 32-len(d)), d...) return padded_d }
[ "func", "(", "priv", "*", "PrivateKey", ")", "ToBytes", "(", ")", "(", "b", "[", "]", "byte", ")", "{", "d", ":=", "priv", ".", "D", ".", "Bytes", "(", ")", "\n\n", "/* Pad D to 32 bytes */", "padded_d", ":=", "append", "(", "bytes", ".", "Repeat", ...
// ToBytes converts a Bitcoin private key to a 32-byte byte slice.
[ "ToBytes", "converts", "a", "Bitcoin", "private", "key", "to", "a", "32", "-", "byte", "byte", "slice", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L278-L285
26,756
vsergeev/btckeygenie
btckey/btckey.go
FromBytes
func (priv *PrivateKey) FromBytes(b []byte) (err error) { if len(b) != 32 { return fmt.Errorf("Invalid private key bytes length %d, expected 32.", len(b)) } priv.D = new(big.Int).SetBytes(b) /* Derive public key from private key */ priv.derive() return nil }
go
func (priv *PrivateKey) FromBytes(b []byte) (err error) { if len(b) != 32 { return fmt.Errorf("Invalid private key bytes length %d, expected 32.", len(b)) } priv.D = new(big.Int).SetBytes(b) /* Derive public key from private key */ priv.derive() return nil }
[ "func", "(", "priv", "*", "PrivateKey", ")", "FromBytes", "(", "b", "[", "]", "byte", ")", "(", "err", "error", ")", "{", "if", "len", "(", "b", ")", "!=", "32", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "b", ")",...
// FromBytes converts a 32-byte byte slice to a Bitcoin private key and derives the corresponding Bitcoin public key.
[ "FromBytes", "converts", "a", "32", "-", "byte", "byte", "slice", "to", "a", "Bitcoin", "private", "key", "and", "derives", "the", "corresponding", "Bitcoin", "public", "key", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L288-L299
26,757
vsergeev/btckeygenie
btckey/btckey.go
ToWIF
func (priv *PrivateKey) ToWIF() (wif string) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Convert the private key to bytes */ priv_bytes := priv.ToBytes() /* Convert bytes to base-58 check encoded string with version 0x80 */ wif = b58checkencode(0x80, priv_bytes) return wif }
go
func (priv *PrivateKey) ToWIF() (wif string) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Convert the private key to bytes */ priv_bytes := priv.ToBytes() /* Convert bytes to base-58 check encoded string with version 0x80 */ wif = b58checkencode(0x80, priv_bytes) return wif }
[ "func", "(", "priv", "*", "PrivateKey", ")", "ToWIF", "(", ")", "(", "wif", "string", ")", "{", "/* See https://en.bitcoin.it/wiki/Wallet_import_format */", "/* Convert the private key to bytes */", "priv_bytes", ":=", "priv", ".", "ToBytes", "(", ")", "\n\n", "/* Con...
// ToWIF converts a Bitcoin private key to a Wallet Import Format string.
[ "ToWIF", "converts", "a", "Bitcoin", "private", "key", "to", "a", "Wallet", "Import", "Format", "string", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L302-L312
26,758
vsergeev/btckeygenie
btckey/btckey.go
ToWIFC
func (priv *PrivateKey) ToWIFC() (wifc string) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Convert the private key to bytes */ priv_bytes := priv.ToBytes() /* Append 0x01 to tell Bitcoin wallet to use compressed public keys */ priv_bytes = append(priv_bytes, []byte{0x01}...) /* Convert bytes...
go
func (priv *PrivateKey) ToWIFC() (wifc string) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Convert the private key to bytes */ priv_bytes := priv.ToBytes() /* Append 0x01 to tell Bitcoin wallet to use compressed public keys */ priv_bytes = append(priv_bytes, []byte{0x01}...) /* Convert bytes...
[ "func", "(", "priv", "*", "PrivateKey", ")", "ToWIFC", "(", ")", "(", "wifc", "string", ")", "{", "/* See https://en.bitcoin.it/wiki/Wallet_import_format */", "/* Convert the private key to bytes */", "priv_bytes", ":=", "priv", ".", "ToBytes", "(", ")", "\n\n", "/* A...
// ToWIFC converts a Bitcoin private key to a Wallet Import Format string with the public key compressed flag.
[ "ToWIFC", "converts", "a", "Bitcoin", "private", "key", "to", "a", "Wallet", "Import", "Format", "string", "with", "the", "public", "key", "compressed", "flag", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L315-L328
26,759
vsergeev/btckeygenie
btckey/btckey.go
FromWIF
func (priv *PrivateKey) FromWIF(wif string) (err error) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Base58 Check Decode the WIF string */ ver, priv_bytes, err := b58checkdecode(wif) if err != nil { return err } /* Check that the version byte is 0x80 */ if ver != 0x80 { return fmt.Errorf(...
go
func (priv *PrivateKey) FromWIF(wif string) (err error) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Base58 Check Decode the WIF string */ ver, priv_bytes, err := b58checkdecode(wif) if err != nil { return err } /* Check that the version byte is 0x80 */ if ver != 0x80 { return fmt.Errorf(...
[ "func", "(", "priv", "*", "PrivateKey", ")", "FromWIF", "(", "wif", "string", ")", "(", "err", "error", ")", "{", "/* See https://en.bitcoin.it/wiki/Wallet_import_format */", "/* Base58 Check Decode the WIF string */", "ver", ",", "priv_bytes", ",", "err", ":=", "b58c...
// FromWIF converts a Wallet Import Format string to a Bitcoin private key and derives the corresponding Bitcoin public key.
[ "FromWIF", "converts", "a", "Wallet", "Import", "Format", "string", "to", "a", "Bitcoin", "private", "key", "and", "derives", "the", "corresponding", "Bitcoin", "public", "key", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L331-L363
26,760
vsergeev/btckeygenie
btckey/btckey.go
ToBytesUncompressed
func (pub *PublicKey) ToBytesUncompressed() (b []byte) { /* See Certicom SEC1 2.3.3, pg. 10 */ x := pub.X.Bytes() y := pub.Y.Bytes() /* Pad X and Y coordinate bytes to 32-bytes */ padded_x := append(bytes.Repeat([]byte{0x00}, 32-len(x)), x...) padded_y := append(bytes.Repeat([]byte{0x00}, 32-len(y)), y...) /*...
go
func (pub *PublicKey) ToBytesUncompressed() (b []byte) { /* See Certicom SEC1 2.3.3, pg. 10 */ x := pub.X.Bytes() y := pub.Y.Bytes() /* Pad X and Y coordinate bytes to 32-bytes */ padded_x := append(bytes.Repeat([]byte{0x00}, 32-len(x)), x...) padded_y := append(bytes.Repeat([]byte{0x00}, 32-len(y)), y...) /*...
[ "func", "(", "pub", "*", "PublicKey", ")", "ToBytesUncompressed", "(", ")", "(", "b", "[", "]", "byte", ")", "{", "/* See Certicom SEC1 2.3.3, pg. 10 */", "x", ":=", "pub", ".", "X", ".", "Bytes", "(", ")", "\n", "y", ":=", "pub", ".", "Y", ".", "Byt...
// ToBytesUncompressed converts a Bitcoin public key to a 65-byte byte slice without point compression.
[ "ToBytesUncompressed", "converts", "a", "Bitcoin", "public", "key", "to", "a", "65", "-", "byte", "byte", "slice", "without", "point", "compression", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L387-L399
26,761
vsergeev/btckeygenie
btckey/btckey.go
ToAddress
func (pub *PublicKey) ToAddress() (address string) { /* See https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses */ /* Convert the public key to bytes */ pub_bytes := pub.ToBytes() /* SHA256 Hash */ sha256_h := sha256.New() sha256_h.Reset() sha256_h.Write(pub_bytes) pub_hash_1 := sha256_h.Sum(...
go
func (pub *PublicKey) ToAddress() (address string) { /* See https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses */ /* Convert the public key to bytes */ pub_bytes := pub.ToBytes() /* SHA256 Hash */ sha256_h := sha256.New() sha256_h.Reset() sha256_h.Write(pub_bytes) pub_hash_1 := sha256_h.Sum(...
[ "func", "(", "pub", "*", "PublicKey", ")", "ToAddress", "(", ")", "(", "address", "string", ")", "{", "/* See https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses */", "/* Convert the public key to bytes */", "pub_bytes", ":=", "pub", ".", "ToBytes", "(", ...
// ToAddress converts a Bitcoin public key to a compressed Bitcoin address string.
[ "ToAddress", "converts", "a", "Bitcoin", "public", "key", "to", "a", "compressed", "Bitcoin", "address", "string", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L447-L469
26,762
vsergeev/btckeygenie
btckey/elliptic.go
format
func (p *Point) format() string { if p.X == nil && p.Y == nil { return "(inf,inf)" } return fmt.Sprintf("(%s,%s)", hex.EncodeToString(p.X.Bytes()), hex.EncodeToString(p.Y.Bytes())) }
go
func (p *Point) format() string { if p.X == nil && p.Y == nil { return "(inf,inf)" } return fmt.Sprintf("(%s,%s)", hex.EncodeToString(p.X.Bytes()), hex.EncodeToString(p.Y.Bytes())) }
[ "func", "(", "p", "*", "Point", ")", "format", "(", ")", "string", "{", "if", "p", ".", "X", "==", "nil", "&&", "p", ".", "Y", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "...
// format formats the bytes of a point for debugging.
[ "format", "formats", "the", "bytes", "of", "a", "point", "for", "debugging", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/elliptic.go#L43-L48
26,763
vsergeev/btckeygenie
btckey/elliptic.go
IsOnCurve
func (ec *EllipticCurve) IsOnCurve(P Point) bool { if ec.IsInfinity(P) { return false } /* y**2 = x**3 + a*x + b % p */ lhs := mulMod(P.Y, P.Y, ec.P) rhs := addMod( addMod( expMod(P.X, big.NewInt(3), ec.P), mulMod(ec.A, P.X, ec.P), ec.P), ec.B, ec.P) if lhs.Cmp(rhs) == 0 { return true } return...
go
func (ec *EllipticCurve) IsOnCurve(P Point) bool { if ec.IsInfinity(P) { return false } /* y**2 = x**3 + a*x + b % p */ lhs := mulMod(P.Y, P.Y, ec.P) rhs := addMod( addMod( expMod(P.X, big.NewInt(3), ec.P), mulMod(ec.A, P.X, ec.P), ec.P), ec.B, ec.P) if lhs.Cmp(rhs) == 0 { return true } return...
[ "func", "(", "ec", "*", "EllipticCurve", ")", "IsOnCurve", "(", "P", "Point", ")", "bool", "{", "if", "ec", ".", "IsInfinity", "(", "P", ")", "{", "return", "false", "\n", "}", "\n\n", "/* y**2 = x**3 + a*x + b % p */", "lhs", ":=", "mulMod", "(", "P", ...
// IsOnCurve checks if point P is on EllipticCurve ec.
[ "IsOnCurve", "checks", "if", "point", "P", "is", "on", "EllipticCurve", "ec", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/elliptic.go#L128-L146
26,764
gocarina/gocsv
csv.go
LazyCSVReader
func LazyCSVReader(in io.Reader) CSVReader { csvReader := csv.NewReader(in) csvReader.LazyQuotes = true csvReader.TrimLeadingSpace = true return csvReader }
go
func LazyCSVReader(in io.Reader) CSVReader { csvReader := csv.NewReader(in) csvReader.LazyQuotes = true csvReader.TrimLeadingSpace = true return csvReader }
[ "func", "LazyCSVReader", "(", "in", "io", ".", "Reader", ")", "CSVReader", "{", "csvReader", ":=", "csv", ".", "NewReader", "(", "in", ")", "\n", "csvReader", ".", "LazyQuotes", "=", "true", "\n", "csvReader", ".", "TrimLeadingSpace", "=", "true", "\n", ...
// LazyCSVReader returns a lazy CSV reader, with LazyQuotes and TrimLeadingSpace.
[ "LazyCSVReader", "returns", "a", "lazy", "CSV", "reader", "with", "LazyQuotes", "and", "TrimLeadingSpace", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L72-L77
26,765
gocarina/gocsv
csv.go
MarshalString
func MarshalString(in interface{}) (out string, err error) { bufferString := bytes.NewBufferString(out) if err := Marshal(in, bufferString); err != nil { return "", err } return bufferString.String(), nil }
go
func MarshalString(in interface{}) (out string, err error) { bufferString := bytes.NewBufferString(out) if err := Marshal(in, bufferString); err != nil { return "", err } return bufferString.String(), nil }
[ "func", "MarshalString", "(", "in", "interface", "{", "}", ")", "(", "out", "string", ",", "err", "error", ")", "{", "bufferString", ":=", "bytes", ".", "NewBufferString", "(", "out", ")", "\n", "if", "err", ":=", "Marshal", "(", "in", ",", "bufferStri...
// MarshalString returns the CSV string from the interface.
[ "MarshalString", "returns", "the", "CSV", "string", "from", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L97-L103
26,766
gocarina/gocsv
csv.go
MarshalBytes
func MarshalBytes(in interface{}) (out []byte, err error) { bufferString := bytes.NewBuffer(out) if err := Marshal(in, bufferString); err != nil { return nil, err } return bufferString.Bytes(), nil }
go
func MarshalBytes(in interface{}) (out []byte, err error) { bufferString := bytes.NewBuffer(out) if err := Marshal(in, bufferString); err != nil { return nil, err } return bufferString.Bytes(), nil }
[ "func", "MarshalBytes", "(", "in", "interface", "{", "}", ")", "(", "out", "[", "]", "byte", ",", "err", "error", ")", "{", "bufferString", ":=", "bytes", ".", "NewBuffer", "(", "out", ")", "\n", "if", "err", ":=", "Marshal", "(", "in", ",", "buffe...
// MarshalBytes returns the CSV bytes from the interface.
[ "MarshalBytes", "returns", "the", "CSV", "bytes", "from", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L106-L112
26,767
gocarina/gocsv
csv.go
MarshalCSV
func MarshalCSV(in interface{}, out *SafeCSVWriter) (err error) { return writeTo(out, in, false) }
go
func MarshalCSV(in interface{}, out *SafeCSVWriter) (err error) { return writeTo(out, in, false) }
[ "func", "MarshalCSV", "(", "in", "interface", "{", "}", ",", "out", "*", "SafeCSVWriter", ")", "(", "err", "error", ")", "{", "return", "writeTo", "(", "out", ",", "in", ",", "false", ")", "\n", "}" ]
// MarshalCSV returns the CSV in writer from the interface.
[ "MarshalCSV", "returns", "the", "CSV", "in", "writer", "from", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L132-L134
26,768
gocarina/gocsv
csv.go
MarshalCSVWithoutHeaders
func MarshalCSVWithoutHeaders(in interface{}, out *SafeCSVWriter) (err error) { return writeTo(out, in, true) }
go
func MarshalCSVWithoutHeaders(in interface{}, out *SafeCSVWriter) (err error) { return writeTo(out, in, true) }
[ "func", "MarshalCSVWithoutHeaders", "(", "in", "interface", "{", "}", ",", "out", "*", "SafeCSVWriter", ")", "(", "err", "error", ")", "{", "return", "writeTo", "(", "out", ",", "in", ",", "true", ")", "\n", "}" ]
// MarshalCSVWithoutHeaders returns the CSV in writer from the interface.
[ "MarshalCSVWithoutHeaders", "returns", "the", "CSV", "in", "writer", "from", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L137-L139
26,769
gocarina/gocsv
csv.go
UnmarshalString
func UnmarshalString(in string, out interface{}) error { return Unmarshal(strings.NewReader(in), out) }
go
func UnmarshalString(in string, out interface{}) error { return Unmarshal(strings.NewReader(in), out) }
[ "func", "UnmarshalString", "(", "in", "string", ",", "out", "interface", "{", "}", ")", "error", "{", "return", "Unmarshal", "(", "strings", ".", "NewReader", "(", "in", ")", ",", "out", ")", "\n", "}" ]
// UnmarshalString parses the CSV from the string in the interface.
[ "UnmarshalString", "parses", "the", "CSV", "from", "the", "string", "in", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L150-L152
26,770
gocarina/gocsv
csv.go
UnmarshalBytes
func UnmarshalBytes(in []byte, out interface{}) error { return Unmarshal(bytes.NewReader(in), out) }
go
func UnmarshalBytes(in []byte, out interface{}) error { return Unmarshal(bytes.NewReader(in), out) }
[ "func", "UnmarshalBytes", "(", "in", "[", "]", "byte", ",", "out", "interface", "{", "}", ")", "error", "{", "return", "Unmarshal", "(", "bytes", ".", "NewReader", "(", "in", ")", ",", "out", ")", "\n", "}" ]
// UnmarshalBytes parses the CSV from the bytes in the interface.
[ "UnmarshalBytes", "parses", "the", "CSV", "from", "the", "bytes", "in", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L155-L157
26,771
gocarina/gocsv
csv.go
Unmarshal
func Unmarshal(in io.Reader, out interface{}) error { return readTo(newDecoder(in), out) }
go
func Unmarshal(in io.Reader, out interface{}) error { return readTo(newDecoder(in), out) }
[ "func", "Unmarshal", "(", "in", "io", ".", "Reader", ",", "out", "interface", "{", "}", ")", "error", "{", "return", "readTo", "(", "newDecoder", "(", "in", ")", ",", "out", ")", "\n", "}" ]
// Unmarshal parses the CSV from the reader in the interface.
[ "Unmarshal", "parses", "the", "CSV", "from", "the", "reader", "in", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L160-L162
26,772
gocarina/gocsv
csv.go
UnmarshalWithoutHeaders
func UnmarshalWithoutHeaders(in io.Reader, out interface{}) error { return readToWithoutHeaders(newDecoder(in), out) }
go
func UnmarshalWithoutHeaders(in io.Reader, out interface{}) error { return readToWithoutHeaders(newDecoder(in), out) }
[ "func", "UnmarshalWithoutHeaders", "(", "in", "io", ".", "Reader", ",", "out", "interface", "{", "}", ")", "error", "{", "return", "readToWithoutHeaders", "(", "newDecoder", "(", "in", ")", ",", "out", ")", "\n", "}" ]
// UnmarshalWithoutHeaders parses the CSV from the reader in the interface.
[ "UnmarshalWithoutHeaders", "parses", "the", "CSV", "from", "the", "reader", "in", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L165-L167
26,773
gocarina/gocsv
csv.go
UnmarshalToChan
func UnmarshalToChan(in io.Reader, c interface{}) error { if c == nil { return fmt.Errorf("goscv: channel is %v", c) } return readEach(newDecoder(in), c) }
go
func UnmarshalToChan(in io.Reader, c interface{}) error { if c == nil { return fmt.Errorf("goscv: channel is %v", c) } return readEach(newDecoder(in), c) }
[ "func", "UnmarshalToChan", "(", "in", "io", ".", "Reader", ",", "c", "interface", "{", "}", ")", "error", "{", "if", "c", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "c", ")", "\n", "}", "\n", "return", "readEach", "("...
// UnmarshalToChan parses the CSV from the reader and send each value in the chan c. // The channel must have a concrete type.
[ "UnmarshalToChan", "parses", "the", "CSV", "from", "the", "reader", "and", "send", "each", "value", "in", "the", "chan", "c", ".", "The", "channel", "must", "have", "a", "concrete", "type", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L186-L191
26,774
gocarina/gocsv
csv.go
UnmarshalDecoderToChan
func UnmarshalDecoderToChan(in SimpleDecoder, c interface{}) error { if c == nil { return fmt.Errorf("goscv: channel is %v", c) } return readEach(in, c) }
go
func UnmarshalDecoderToChan(in SimpleDecoder, c interface{}) error { if c == nil { return fmt.Errorf("goscv: channel is %v", c) } return readEach(in, c) }
[ "func", "UnmarshalDecoderToChan", "(", "in", "SimpleDecoder", ",", "c", "interface", "{", "}", ")", "error", "{", "if", "c", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "c", ")", "\n", "}", "\n", "return", "readEach", "(",...
// UnmarshalDecoderToChan parses the CSV from the decoder and send each value in the chan c. // The channel must have a concrete type.
[ "UnmarshalDecoderToChan", "parses", "the", "CSV", "from", "the", "decoder", "and", "send", "each", "value", "in", "the", "chan", "c", ".", "The", "channel", "must", "have", "a", "concrete", "type", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L195-L200
26,775
gocarina/gocsv
csv.go
UnmarshalStringToChan
func UnmarshalStringToChan(in string, c interface{}) error { return UnmarshalToChan(strings.NewReader(in), c) }
go
func UnmarshalStringToChan(in string, c interface{}) error { return UnmarshalToChan(strings.NewReader(in), c) }
[ "func", "UnmarshalStringToChan", "(", "in", "string", ",", "c", "interface", "{", "}", ")", "error", "{", "return", "UnmarshalToChan", "(", "strings", ".", "NewReader", "(", "in", ")", ",", "c", ")", "\n", "}" ]
// UnmarshalStringToChan parses the CSV from the string and send each value in the chan c. // The channel must have a concrete type.
[ "UnmarshalStringToChan", "parses", "the", "CSV", "from", "the", "string", "and", "send", "each", "value", "in", "the", "chan", "c", ".", "The", "channel", "must", "have", "a", "concrete", "type", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L204-L206
26,776
gocarina/gocsv
csv.go
UnmarshalBytesToChan
func UnmarshalBytesToChan(in []byte, c interface{}) error { return UnmarshalToChan(bytes.NewReader(in), c) }
go
func UnmarshalBytesToChan(in []byte, c interface{}) error { return UnmarshalToChan(bytes.NewReader(in), c) }
[ "func", "UnmarshalBytesToChan", "(", "in", "[", "]", "byte", ",", "c", "interface", "{", "}", ")", "error", "{", "return", "UnmarshalToChan", "(", "bytes", ".", "NewReader", "(", "in", ")", ",", "c", ")", "\n", "}" ]
// UnmarshalBytesToChan parses the CSV from the bytes and send each value in the chan c. // The channel must have a concrete type.
[ "UnmarshalBytesToChan", "parses", "the", "CSV", "from", "the", "bytes", "and", "send", "each", "value", "in", "the", "chan", "c", ".", "The", "channel", "must", "have", "a", "concrete", "type", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L210-L212
26,777
gocarina/gocsv
csv.go
CSVToMap
func CSVToMap(in io.Reader) (map[string]string, error) { decoder := newDecoder(in) header, err := decoder.getCSVRow() if err != nil { return nil, err } if len(header) != 2 { return nil, fmt.Errorf("maps can only be created for csv of two columns") } m := make(map[string]string) for { line, err := decoder....
go
func CSVToMap(in io.Reader) (map[string]string, error) { decoder := newDecoder(in) header, err := decoder.getCSVRow() if err != nil { return nil, err } if len(header) != 2 { return nil, fmt.Errorf("maps can only be created for csv of two columns") } m := make(map[string]string) for { line, err := decoder....
[ "func", "CSVToMap", "(", "in", "io", ".", "Reader", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "decoder", ":=", "newDecoder", "(", "in", ")", "\n", "header", ",", "err", ":=", "decoder", ".", "getCSVRow", "(", ")", "\n",...
// CSVToMap creates a simple map from a CSV of 2 columns.
[ "CSVToMap", "creates", "a", "simple", "map", "from", "a", "CSV", "of", "2", "columns", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L283-L303
26,778
gocarina/gocsv
csv.go
CSVToMaps
func CSVToMaps(reader io.Reader) ([]map[string]string, error) { r := csv.NewReader(reader) rows := []map[string]string{} var header []string for { record, err := r.Read() if err == io.EOF { break } if err != nil { return nil, err } if header == nil { header = record } else { dict := map[st...
go
func CSVToMaps(reader io.Reader) ([]map[string]string, error) { r := csv.NewReader(reader) rows := []map[string]string{} var header []string for { record, err := r.Read() if err == io.EOF { break } if err != nil { return nil, err } if header == nil { header = record } else { dict := map[st...
[ "func", "CSVToMaps", "(", "reader", "io", ".", "Reader", ")", "(", "[", "]", "map", "[", "string", "]", "string", ",", "error", ")", "{", "r", ":=", "csv", ".", "NewReader", "(", "reader", ")", "\n", "rows", ":=", "[", "]", "map", "[", "string", ...
// CSVToMaps takes a reader and returns an array of dictionaries, using the header row as the keys
[ "CSVToMaps", "takes", "a", "reader", "and", "returns", "an", "array", "of", "dictionaries", "using", "the", "header", "row", "as", "the", "keys" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L306-L329
26,779
gocarina/gocsv
encode.go
ensureInType
func ensureInType(outType reflect.Type) error { switch outType.Kind() { case reflect.Slice: fallthrough case reflect.Array: return nil } return fmt.Errorf("cannot use " + outType.String() + ", only slice or array supported") }
go
func ensureInType(outType reflect.Type) error { switch outType.Kind() { case reflect.Slice: fallthrough case reflect.Array: return nil } return fmt.Errorf("cannot use " + outType.String() + ", only slice or array supported") }
[ "func", "ensureInType", "(", "outType", "reflect", ".", "Type", ")", "error", "{", "switch", "outType", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Slice", ":", "fallthrough", "\n", "case", "reflect", ".", "Array", ":", "return", "nil", "\n", ...
// Check if the inType is an array or a slice
[ "Check", "if", "the", "inType", "is", "an", "array", "or", "a", "slice" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/encode.go#L114-L122
26,780
gocarina/gocsv
decode.go
maybeDoubleHeaderNames
func maybeDoubleHeaderNames(headers []string) error { headerMap := make(map[string]bool, len(headers)) for _, v := range headers { if _, ok := headerMap[v]; ok { return fmt.Errorf("Repeated header name: %v", v) } headerMap[v] = true } return nil }
go
func maybeDoubleHeaderNames(headers []string) error { headerMap := make(map[string]bool, len(headers)) for _, v := range headers { if _, ok := headerMap[v]; ok { return fmt.Errorf("Repeated header name: %v", v) } headerMap[v] = true } return nil }
[ "func", "maybeDoubleHeaderNames", "(", "headers", "[", "]", "string", ")", "error", "{", "headerMap", ":=", "make", "(", "map", "[", "string", "]", "bool", ",", "len", "(", "headers", ")", ")", "\n", "for", "_", ",", "v", ":=", "range", "headers", "{...
// Check that no header name is repeated twice
[ "Check", "that", "no", "header", "name", "is", "repeated", "twice" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/decode.go#L114-L123
26,781
gocarina/gocsv
decode.go
ensureOutType
func ensureOutType(outType reflect.Type) error { switch outType.Kind() { case reflect.Slice: fallthrough case reflect.Chan: fallthrough case reflect.Array: return nil } return fmt.Errorf("cannot use " + outType.String() + ", only slice or array supported") }
go
func ensureOutType(outType reflect.Type) error { switch outType.Kind() { case reflect.Slice: fallthrough case reflect.Chan: fallthrough case reflect.Array: return nil } return fmt.Errorf("cannot use " + outType.String() + ", only slice or array supported") }
[ "func", "ensureOutType", "(", "outType", "reflect", ".", "Type", ")", "error", "{", "switch", "outType", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Slice", ":", "fallthrough", "\n", "case", "reflect", ".", "Chan", ":", "fallthrough", "\n", "cas...
// Check if the outType is an array or a slice
[ "Check", "if", "the", "outType", "is", "an", "array", "or", "a", "slice" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/decode.go#L304-L314
26,782
gocarina/gocsv
decode.go
ensureOutInnerType
func ensureOutInnerType(outInnerType reflect.Type) error { switch outInnerType.Kind() { case reflect.Struct: return nil } return fmt.Errorf("cannot use " + outInnerType.String() + ", only struct supported") }
go
func ensureOutInnerType(outInnerType reflect.Type) error { switch outInnerType.Kind() { case reflect.Struct: return nil } return fmt.Errorf("cannot use " + outInnerType.String() + ", only struct supported") }
[ "func", "ensureOutInnerType", "(", "outInnerType", "reflect", ".", "Type", ")", "error", "{", "switch", "outInnerType", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Struct", ":", "return", "nil", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "...
// Check if the outInnerType is of type struct
[ "Check", "if", "the", "outInnerType", "is", "of", "type", "struct" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/decode.go#L317-L323
26,783
gocarina/gocsv
unmarshaller.go
NewUnmarshaller
func NewUnmarshaller(reader *csv.Reader, out interface{}) (*Unmarshaller, error) { headers, err := reader.Read() if err != nil { return nil, err } um := &Unmarshaller{reader: reader, outType: reflect.TypeOf(out)} err = validate(um, out, headers) if err != nil { return nil, err } return um, nil }
go
func NewUnmarshaller(reader *csv.Reader, out interface{}) (*Unmarshaller, error) { headers, err := reader.Read() if err != nil { return nil, err } um := &Unmarshaller{reader: reader, outType: reflect.TypeOf(out)} err = validate(um, out, headers) if err != nil { return nil, err } return um, nil }
[ "func", "NewUnmarshaller", "(", "reader", "*", "csv", ".", "Reader", ",", "out", "interface", "{", "}", ")", "(", "*", "Unmarshaller", ",", "error", ")", "{", "headers", ",", "err", ":=", "reader", ".", "Read", "(", ")", "\n", "if", "err", "!=", "n...
// NewUnmarshaller creates an unmarshaller from a csv.Reader and a struct.
[ "NewUnmarshaller", "creates", "an", "unmarshaller", "from", "a", "csv", ".", "Reader", "and", "a", "struct", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/unmarshaller.go#L21-L33
26,784
gocarina/gocsv
unmarshaller.go
validate
func validate(um *Unmarshaller, s interface{}, headers []string) error { concreteType := reflect.TypeOf(s) if concreteType.Kind() == reflect.Ptr { concreteType = concreteType.Elem() } if err := ensureOutInnerType(concreteType); err != nil { return err } structInfo := getStructInfo(concreteType) // Get struct ...
go
func validate(um *Unmarshaller, s interface{}, headers []string) error { concreteType := reflect.TypeOf(s) if concreteType.Kind() == reflect.Ptr { concreteType = concreteType.Elem() } if err := ensureOutInnerType(concreteType); err != nil { return err } structInfo := getStructInfo(concreteType) // Get struct ...
[ "func", "validate", "(", "um", "*", "Unmarshaller", ",", "s", "interface", "{", "}", ",", "headers", "[", "]", "string", ")", "error", "{", "concreteType", ":=", "reflect", ".", "TypeOf", "(", "s", ")", "\n", "if", "concreteType", ".", "Kind", "(", "...
// validate ensures that a struct was used to create the Unmarshaller, and validates // CSV headers against the CSV tags in the struct.
[ "validate", "ensures", "that", "a", "struct", "was", "used", "to", "create", "the", "Unmarshaller", "and", "validates", "CSV", "headers", "against", "the", "CSV", "tags", "in", "the", "struct", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/unmarshaller.go#L58-L93
26,785
gocarina/gocsv
unmarshaller.go
unmarshalRow
func (um *Unmarshaller) unmarshalRow(row []string, unmatched map[string]string) (interface{}, error) { isPointer := false concreteOutType := um.outType if um.outType.Kind() == reflect.Ptr { isPointer = true concreteOutType = concreteOutType.Elem() } outValue := createNewOutInner(isPointer, concreteOutType) fo...
go
func (um *Unmarshaller) unmarshalRow(row []string, unmatched map[string]string) (interface{}, error) { isPointer := false concreteOutType := um.outType if um.outType.Kind() == reflect.Ptr { isPointer = true concreteOutType = concreteOutType.Elem() } outValue := createNewOutInner(isPointer, concreteOutType) fo...
[ "func", "(", "um", "*", "Unmarshaller", ")", "unmarshalRow", "(", "row", "[", "]", "string", ",", "unmatched", "map", "[", "string", "]", "string", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "isPointer", ":=", "false", "\n", "concreteOutT...
// unmarshalRow converts a CSV row to a struct, based on CSV struct tags. // If unmatched is non nil, it is populated with any columns that don't map to a struct field
[ "unmarshalRow", "converts", "a", "CSV", "row", "to", "a", "struct", "based", "on", "CSV", "struct", "tags", ".", "If", "unmatched", "is", "non", "nil", "it", "is", "populated", "with", "any", "columns", "that", "don", "t", "map", "to", "a", "struct", "...
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/unmarshaller.go#L97-L115
26,786
golang/leveldb
db/db.go
close
func (m *mergingIter) close(i int) error { t := m.iters[i] if t == nil { return nil } err := t.Close() if m.err == nil { m.err = err } m.iters[i] = nil m.keys[i] = nil return err }
go
func (m *mergingIter) close(i int) error { t := m.iters[i] if t == nil { return nil } err := t.Close() if m.err == nil { m.err = err } m.iters[i] = nil m.keys[i] = nil return err }
[ "func", "(", "m", "*", "mergingIter", ")", "close", "(", "i", "int", ")", "error", "{", "t", ":=", "m", ".", "iters", "[", "i", "]", "\n", "if", "t", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "err", ":=", "t", ".", "Close", "(", "...
// close records that the i'th input iterator is done.
[ "close", "records", "that", "the", "i", "th", "input", "iterator", "is", "done", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/db/db.go#L223-L235
26,787
golang/leveldb
compaction.go
pickCompaction
func pickCompaction(vs *versionSet) (c *compaction) { cur := vs.currentVersion() // Pick a compaction based on size. If none exist, pick one based on seeks. if cur.compactionScore >= 1 { c = &compaction{ version: cur, level: cur.compactionLevel, } // TODO: Pick the first file that comes after the comp...
go
func pickCompaction(vs *versionSet) (c *compaction) { cur := vs.currentVersion() // Pick a compaction based on size. If none exist, pick one based on seeks. if cur.compactionScore >= 1 { c = &compaction{ version: cur, level: cur.compactionLevel, } // TODO: Pick the first file that comes after the comp...
[ "func", "pickCompaction", "(", "vs", "*", "versionSet", ")", "(", "c", "*", "compaction", ")", "{", "cur", ":=", "vs", ".", "currentVersion", "(", ")", "\n\n", "// Pick a compaction based on size. If none exist, pick one based on seeks.", "if", "cur", ".", "compacti...
// pickCompaction picks the best compaction, if any, for vs' current version.
[ "pickCompaction", "picks", "the", "best", "compaction", "if", "any", "for", "vs", "current", "version", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/compaction.go#L43-L73
26,788
golang/leveldb
compaction.go
grow
func (c *compaction) grow(vs *versionSet, sm, la internalKey) bool { if len(c.inputs[1]) == 0 { return false } grow0 := c.version.overlaps(c.level, vs.ucmp, sm.ukey(), la.ukey()) if len(grow0) <= len(c.inputs[0]) { return false } if totalSize(grow0)+totalSize(c.inputs[1]) >= expandedCompactionByteSizeLimit { ...
go
func (c *compaction) grow(vs *versionSet, sm, la internalKey) bool { if len(c.inputs[1]) == 0 { return false } grow0 := c.version.overlaps(c.level, vs.ucmp, sm.ukey(), la.ukey()) if len(grow0) <= len(c.inputs[0]) { return false } if totalSize(grow0)+totalSize(c.inputs[1]) >= expandedCompactionByteSizeLimit { ...
[ "func", "(", "c", "*", "compaction", ")", "grow", "(", "vs", "*", "versionSet", ",", "sm", ",", "la", "internalKey", ")", "bool", "{", "if", "len", "(", "c", ".", "inputs", "[", "1", "]", ")", "==", "0", "{", "return", "false", "\n", "}", "\n",...
// grow grows the number of inputs at c.level without changing the number of // c.level+1 files in the compaction, and returns whether the inputs grew. sm // and la are the smallest and largest internalKeys in all of the inputs.
[ "grow", "grows", "the", "number", "of", "inputs", "at", "c", ".", "level", "without", "changing", "the", "number", "of", "c", ".", "level", "+", "1", "files", "in", "the", "compaction", "and", "returns", "whether", "the", "inputs", "grew", ".", "sm", "...
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/compaction.go#L100-L119
26,789
golang/leveldb
compaction.go
maybeScheduleCompaction
func (d *DB) maybeScheduleCompaction() { if d.compacting || d.closed { return } // TODO: check for manual compactions. if d.imm == nil { v := d.versions.currentVersion() // TODO: check v.fileToCompact. if v.compactionScore < 1 { // There is no work to be done. return } } d.compacting = true go d....
go
func (d *DB) maybeScheduleCompaction() { if d.compacting || d.closed { return } // TODO: check for manual compactions. if d.imm == nil { v := d.versions.currentVersion() // TODO: check v.fileToCompact. if v.compactionScore < 1 { // There is no work to be done. return } } d.compacting = true go d....
[ "func", "(", "d", "*", "DB", ")", "maybeScheduleCompaction", "(", ")", "{", "if", "d", ".", "compacting", "||", "d", ".", "closed", "{", "return", "\n", "}", "\n", "// TODO: check for manual compactions.", "if", "d", ".", "imm", "==", "nil", "{", "v", ...
// maybeScheduleCompaction schedules a compaction if necessary. // // d.mu must be held when calling this.
[ "maybeScheduleCompaction", "schedules", "a", "compaction", "if", "necessary", ".", "d", ".", "mu", "must", "be", "held", "when", "calling", "this", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/compaction.go#L144-L159
26,790
golang/leveldb
compaction.go
compact
func (d *DB) compact() { d.mu.Lock() defer d.mu.Unlock() if err := d.compact1(); err != nil { // TODO: count consecutive compaction errors and backoff. } d.compacting = false // The previous compaction may have produced too many files in a // level, so reschedule another compaction if needed. d.maybeScheduleC...
go
func (d *DB) compact() { d.mu.Lock() defer d.mu.Unlock() if err := d.compact1(); err != nil { // TODO: count consecutive compaction errors and backoff. } d.compacting = false // The previous compaction may have produced too many files in a // level, so reschedule another compaction if needed. d.maybeScheduleC...
[ "func", "(", "d", "*", "DB", ")", "compact", "(", ")", "{", "d", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "err", ":=", "d", ".", "compact1", "(", ")", ";", "err", "!=", "nil", "...
// compact runs one compaction and maybe schedules another call to compact.
[ "compact", "runs", "one", "compaction", "and", "maybe", "schedules", "another", "call", "to", "compact", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/compaction.go#L162-L173
26,791
golang/leveldb
compaction.go
compact1
func (d *DB) compact1() error { if d.imm != nil { return d.compactMemTable() } // TODO: support manual compactions. c := pickCompaction(&d.versions) if c == nil { return nil } // Check for a trivial move of one table from one level to the next. // We avoid such a move if there is lots of overlapping gran...
go
func (d *DB) compact1() error { if d.imm != nil { return d.compactMemTable() } // TODO: support manual compactions. c := pickCompaction(&d.versions) if c == nil { return nil } // Check for a trivial move of one table from one level to the next. // We avoid such a move if there is lots of overlapping gran...
[ "func", "(", "d", "*", "DB", ")", "compact1", "(", ")", "error", "{", "if", "d", ".", "imm", "!=", "nil", "{", "return", "d", ".", "compactMemTable", "(", ")", "\n", "}", "\n\n", "// TODO: support manual compactions.", "c", ":=", "pickCompaction", "(", ...
// compact1 runs one compaction. // // d.mu must be held when calling this, but the mutex may be dropped and // re-acquired during the course of this method.
[ "compact1", "runs", "one", "compaction", ".", "d", ".", "mu", "must", "be", "held", "when", "calling", "this", "but", "the", "mutex", "may", "be", "dropped", "and", "re", "-", "acquired", "during", "the", "course", "of", "this", "method", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/compaction.go#L179-L222
26,792
golang/leveldb
compaction.go
compactMemTable
func (d *DB) compactMemTable() error { meta, err := d.writeLevel0Table(d.opts.GetFileSystem(), d.imm) if err != nil { return err } err = d.versions.logAndApply(d.dirname, &versionEdit{ logNumber: d.logNumber, newFiles: []newFileEntry{ {level: 0, meta: meta}, }, }) delete(d.pendingOutputs, meta.fileNum)...
go
func (d *DB) compactMemTable() error { meta, err := d.writeLevel0Table(d.opts.GetFileSystem(), d.imm) if err != nil { return err } err = d.versions.logAndApply(d.dirname, &versionEdit{ logNumber: d.logNumber, newFiles: []newFileEntry{ {level: 0, meta: meta}, }, }) delete(d.pendingOutputs, meta.fileNum)...
[ "func", "(", "d", "*", "DB", ")", "compactMemTable", "(", ")", "error", "{", "meta", ",", "err", ":=", "d", ".", "writeLevel0Table", "(", "d", ".", "opts", ".", "GetFileSystem", "(", ")", ",", "d", ".", "imm", ")", "\n", "if", "err", "!=", "nil",...
// compactMemTable runs a compaction that copies d.imm from memory to disk. // // d.mu must be held when calling this, but the mutex may be dropped and // re-acquired during the course of this method.
[ "compactMemTable", "runs", "a", "compaction", "that", "copies", "d", ".", "imm", "from", "memory", "to", "disk", ".", "d", ".", "mu", "must", "be", "held", "when", "calling", "this", "but", "the", "mutex", "may", "be", "dropped", "and", "re", "-", "acq...
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/compaction.go#L228-L246
26,793
golang/leveldb
compaction.go
compactionIterator
func compactionIterator(tc *tableCache, icmp db.Comparer, c *compaction) (cIter db.Iterator, retErr error) { iters := make([]db.Iterator, 0, len(c.inputs[0])+1) defer func() { if retErr != nil { for _, iter := range iters { if iter != nil { iter.Close() } } } }() if c.level != 0 { iter, er...
go
func compactionIterator(tc *tableCache, icmp db.Comparer, c *compaction) (cIter db.Iterator, retErr error) { iters := make([]db.Iterator, 0, len(c.inputs[0])+1) defer func() { if retErr != nil { for _, iter := range iters { if iter != nil { iter.Close() } } } }() if c.level != 0 { iter, er...
[ "func", "compactionIterator", "(", "tc", "*", "tableCache", ",", "icmp", "db", ".", "Comparer", ",", "c", "*", "compaction", ")", "(", "cIter", "db", ".", "Iterator", ",", "retErr", "error", ")", "{", "iters", ":=", "make", "(", "[", "]", "db", ".", ...
// compactionIterator returns an iterator over all the tables in a compaction.
[ "compactionIterator", "returns", "an", "iterator", "over", "all", "the", "tables", "in", "a", "compaction", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/compaction.go#L393-L427
26,794
golang/leveldb
compaction.go
newConcatenatingIterator
func newConcatenatingIterator(tc *tableCache, inputs []fileMetadata) (cIter db.Iterator, retErr error) { iters := make([]db.Iterator, len(inputs)) defer func() { if retErr != nil { for _, iter := range iters { if iter != nil { iter.Close() } } } }() for i, f := range inputs { iter, err := ...
go
func newConcatenatingIterator(tc *tableCache, inputs []fileMetadata) (cIter db.Iterator, retErr error) { iters := make([]db.Iterator, len(inputs)) defer func() { if retErr != nil { for _, iter := range iters { if iter != nil { iter.Close() } } } }() for i, f := range inputs { iter, err := ...
[ "func", "newConcatenatingIterator", "(", "tc", "*", "tableCache", ",", "inputs", "[", "]", "fileMetadata", ")", "(", "cIter", "db", ".", "Iterator", ",", "retErr", "error", ")", "{", "iters", ":=", "make", "(", "[", "]", "db", ".", "Iterator", ",", "le...
// newConcatenatingIterator returns a concatenating iterator over all of the // input tables.
[ "newConcatenatingIterator", "returns", "a", "concatenating", "iterator", "over", "all", "of", "the", "input", "tables", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/compaction.go#L431-L451
26,795
golang/leveldb
table/reader.go
Set
func (r *Reader) Set(key, value []byte, o *db.WriteOptions) error { return errors.New("leveldb/table: cannot Set into a read-only table") }
go
func (r *Reader) Set(key, value []byte, o *db.WriteOptions) error { return errors.New("leveldb/table: cannot Set into a read-only table") }
[ "func", "(", "r", "*", "Reader", ")", "Set", "(", "key", ",", "value", "[", "]", "byte", ",", "o", "*", "db", ".", "WriteOptions", ")", "error", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
// Set is provided to implement the DB interface, but returns an error, as a // Reader cannot write to a table.
[ "Set", "is", "provided", "to", "implement", "the", "DB", "interface", "but", "returns", "an", "error", "as", "a", "Reader", "cannot", "write", "to", "a", "table", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/table/reader.go#L350-L352
26,796
golang/leveldb
table/reader.go
Delete
func (r *Reader) Delete(key []byte, o *db.WriteOptions) error { return errors.New("leveldb/table: cannot Delete from a read-only table") }
go
func (r *Reader) Delete(key []byte, o *db.WriteOptions) error { return errors.New("leveldb/table: cannot Delete from a read-only table") }
[ "func", "(", "r", "*", "Reader", ")", "Delete", "(", "key", "[", "]", "byte", ",", "o", "*", "db", ".", "WriteOptions", ")", "error", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
// Delete is provided to implement the DB interface, but returns an error, as a // Reader cannot write to a table.
[ "Delete", "is", "provided", "to", "implement", "the", "DB", "interface", "but", "returns", "an", "error", "as", "a", "Reader", "cannot", "write", "to", "a", "table", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/table/reader.go#L356-L358
26,797
golang/leveldb
table/reader.go
readBlock
func (r *Reader) readBlock(bh blockHandle) (block, error) { b := make([]byte, bh.length+blockTrailerLen) if _, err := r.file.ReadAt(b, int64(bh.offset)); err != nil { return nil, err } if r.verifyChecksums { checksum0 := binary.LittleEndian.Uint32(b[bh.length+1:]) checksum1 := crc.New(b[:bh.length+1]).Value()...
go
func (r *Reader) readBlock(bh blockHandle) (block, error) { b := make([]byte, bh.length+blockTrailerLen) if _, err := r.file.ReadAt(b, int64(bh.offset)); err != nil { return nil, err } if r.verifyChecksums { checksum0 := binary.LittleEndian.Uint32(b[bh.length+1:]) checksum1 := crc.New(b[:bh.length+1]).Value()...
[ "func", "(", "r", "*", "Reader", ")", "readBlock", "(", "bh", "blockHandle", ")", "(", "block", ",", "error", ")", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "bh", ".", "length", "+", "blockTrailerLen", ")", "\n", "if", "_", ",", "err", ...
// readBlock reads and decompresses a block from disk into memory.
[ "readBlock", "reads", "and", "decompresses", "a", "block", "from", "disk", "into", "memory", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/table/reader.go#L382-L405
26,798
golang/leveldb
table/reader.go
NewReader
func NewReader(f db.File, o *db.Options) *Reader { r := &Reader{ file: f, comparer: o.GetComparer(), verifyChecksums: o.GetVerifyChecksums(), } if f == nil { r.err = errors.New("leveldb/table: nil file") return r } stat, err := f.Stat() if err != nil { r.err = fmt.Errorf("leveldb/tab...
go
func NewReader(f db.File, o *db.Options) *Reader { r := &Reader{ file: f, comparer: o.GetComparer(), verifyChecksums: o.GetVerifyChecksums(), } if f == nil { r.err = errors.New("leveldb/table: nil file") return r } stat, err := f.Stat() if err != nil { r.err = fmt.Errorf("leveldb/tab...
[ "func", "NewReader", "(", "f", "db", ".", "File", ",", "o", "*", "db", ".", "Options", ")", "*", "Reader", "{", "r", ":=", "&", "Reader", "{", "file", ":", "f", ",", "comparer", ":", "o", ".", "GetComparer", "(", ")", ",", "verifyChecksums", ":",...
// NewReader returns a new table reader for the file. Closing the reader will // close the file.
[ "NewReader", "returns", "a", "new", "table", "reader", "for", "the", "file", ".", "Closing", "the", "reader", "will", "close", "the", "file", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/table/reader.go#L457-L506
26,799
golang/leveldb
bloom/bloom.go
MayContain
func (f Filter) MayContain(key []byte) bool { if len(f) < 2 { return false } k := f[len(f)-1] if k > 30 { // This is reserved for potentially new encodings for short Bloom filters. // Consider it a match. return true } nBits := uint32(8 * (len(f) - 1)) h := hash(key) delta := h>>17 | h<<15 for j := uin...
go
func (f Filter) MayContain(key []byte) bool { if len(f) < 2 { return false } k := f[len(f)-1] if k > 30 { // This is reserved for potentially new encodings for short Bloom filters. // Consider it a match. return true } nBits := uint32(8 * (len(f) - 1)) h := hash(key) delta := h>>17 | h<<15 for j := uin...
[ "func", "(", "f", "Filter", ")", "MayContain", "(", "key", "[", "]", "byte", ")", "bool", "{", "if", "len", "(", "f", ")", "<", "2", "{", "return", "false", "\n", "}", "\n", "k", ":=", "f", "[", "len", "(", "f", ")", "-", "1", "]", "\n", ...
// MayContain returns whether the filter may contain given key. False positives // are possible, where it returns true for keys not in the original set.
[ "MayContain", "returns", "whether", "the", "filter", "may", "contain", "given", "key", ".", "False", "positives", "are", "possible", "where", "it", "returns", "true", "for", "keys", "not", "in", "the", "original", "set", "." ]
259d9253d71996b7778a3efb4144fe4892342b18
https://github.com/golang/leveldb/blob/259d9253d71996b7778a3efb4144fe4892342b18/bloom/bloom.go#L13-L34