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,500 | tjfoc/gmsm | sm2/x509.go | ParseDERCRL | func ParseDERCRL(derBytes []byte) (*pkix.CertificateList, error) {
certList := new(pkix.CertificateList)
if rest, err := asn1.Unmarshal(derBytes, certList); err != nil {
return nil, err
} else if len(rest) != 0 {
return nil, errors.New("x509: trailing data after CRL")
}
return certList, nil
} | go | func ParseDERCRL(derBytes []byte) (*pkix.CertificateList, error) {
certList := new(pkix.CertificateList)
if rest, err := asn1.Unmarshal(derBytes, certList); err != nil {
return nil, err
} else if len(rest) != 0 {
return nil, errors.New("x509: trailing data after CRL")
}
return certList, nil
} | [
"func",
"ParseDERCRL",
"(",
"derBytes",
"[",
"]",
"byte",
")",
"(",
"*",
"pkix",
".",
"CertificateList",
",",
"error",
")",
"{",
"certList",
":=",
"new",
"(",
"pkix",
".",
"CertificateList",
")",
"\n",
"if",
"rest",
",",
"err",
":=",
"asn1",
".",
"Un... | // ParseDERCRL parses a DER encoded CRL from the given bytes. | [
"ParseDERCRL",
"parses",
"a",
"DER",
"encoded",
"CRL",
"from",
"the",
"given",
"bytes",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L2014-L2022 |
26,501 | tjfoc/gmsm | sm2/x509.go | CreateCRL | func (c *Certificate) CreateCRL(rand io.Reader, priv interface{}, revokedCerts []pkix.RevokedCertificate, now, expiry time.Time) (crlBytes []byte, err error) {
key, ok := priv.(crypto.Signer)
if !ok {
return nil, errors.New("x509: certificate private key does not implement crypto.Signer")
}
hashFunc, signatureAl... | go | func (c *Certificate) CreateCRL(rand io.Reader, priv interface{}, revokedCerts []pkix.RevokedCertificate, now, expiry time.Time) (crlBytes []byte, err error) {
key, ok := priv.(crypto.Signer)
if !ok {
return nil, errors.New("x509: certificate private key does not implement crypto.Signer")
}
hashFunc, signatureAl... | [
"func",
"(",
"c",
"*",
"Certificate",
")",
"CreateCRL",
"(",
"rand",
"io",
".",
"Reader",
",",
"priv",
"interface",
"{",
"}",
",",
"revokedCerts",
"[",
"]",
"pkix",
".",
"RevokedCertificate",
",",
"now",
",",
"expiry",
"time",
".",
"Time",
")",
"(",
... | // CreateCRL returns a DER encoded CRL, signed by this Certificate, that
// contains the given list of revoked certificates. | [
"CreateCRL",
"returns",
"a",
"DER",
"encoded",
"CRL",
"signed",
"by",
"this",
"Certificate",
"that",
"contains",
"the",
"given",
"list",
"of",
"revoked",
"certificates",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L2026-L2090 |
26,502 | tjfoc/gmsm | sm2/x509.go | newRawAttributes | func newRawAttributes(attributes []pkix.AttributeTypeAndValueSET) ([]asn1.RawValue, error) {
var rawAttributes []asn1.RawValue
b, err := asn1.Marshal(attributes)
if err != nil {
return nil, err
}
rest, err := asn1.Unmarshal(b, &rawAttributes)
if err != nil {
return nil, err
}
if len(rest) != 0 {
return ni... | go | func newRawAttributes(attributes []pkix.AttributeTypeAndValueSET) ([]asn1.RawValue, error) {
var rawAttributes []asn1.RawValue
b, err := asn1.Marshal(attributes)
if err != nil {
return nil, err
}
rest, err := asn1.Unmarshal(b, &rawAttributes)
if err != nil {
return nil, err
}
if len(rest) != 0 {
return ni... | [
"func",
"newRawAttributes",
"(",
"attributes",
"[",
"]",
"pkix",
".",
"AttributeTypeAndValueSET",
")",
"(",
"[",
"]",
"asn1",
".",
"RawValue",
",",
"error",
")",
"{",
"var",
"rawAttributes",
"[",
"]",
"asn1",
".",
"RawValue",
"\n",
"b",
",",
"err",
":=",... | // newRawAttributes converts AttributeTypeAndValueSETs from a template
// CertificateRequest's Attributes into tbsCertificateRequest RawAttributes. | [
"newRawAttributes",
"converts",
"AttributeTypeAndValueSETs",
"from",
"a",
"template",
"CertificateRequest",
"s",
"Attributes",
"into",
"tbsCertificateRequest",
"RawAttributes",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L2155-L2169 |
26,503 | tjfoc/gmsm | sm2/x509.go | parseRawAttributes | func parseRawAttributes(rawAttributes []asn1.RawValue) []pkix.AttributeTypeAndValueSET {
var attributes []pkix.AttributeTypeAndValueSET
for _, rawAttr := range rawAttributes {
var attr pkix.AttributeTypeAndValueSET
rest, err := asn1.Unmarshal(rawAttr.FullBytes, &attr)
// Ignore attributes that don't parse into ... | go | func parseRawAttributes(rawAttributes []asn1.RawValue) []pkix.AttributeTypeAndValueSET {
var attributes []pkix.AttributeTypeAndValueSET
for _, rawAttr := range rawAttributes {
var attr pkix.AttributeTypeAndValueSET
rest, err := asn1.Unmarshal(rawAttr.FullBytes, &attr)
// Ignore attributes that don't parse into ... | [
"func",
"parseRawAttributes",
"(",
"rawAttributes",
"[",
"]",
"asn1",
".",
"RawValue",
")",
"[",
"]",
"pkix",
".",
"AttributeTypeAndValueSET",
"{",
"var",
"attributes",
"[",
"]",
"pkix",
".",
"AttributeTypeAndValueSET",
"\n",
"for",
"_",
",",
"rawAttr",
":=",
... | // parseRawAttributes Unmarshals RawAttributes intos AttributeTypeAndValueSETs. | [
"parseRawAttributes",
"Unmarshals",
"RawAttributes",
"intos",
"AttributeTypeAndValueSETs",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L2172-L2184 |
26,504 | tjfoc/gmsm | sm2/x509.go | parseCSRExtensions | func parseCSRExtensions(rawAttributes []asn1.RawValue) ([]pkix.Extension, error) {
// pkcs10Attribute reflects the Attribute structure from section 4.1 of
// https://tools.ietf.org/html/rfc2986.
type pkcs10Attribute struct {
Id asn1.ObjectIdentifier
Values []asn1.RawValue `asn1:"set"`
}
var ret []pkix.Ext... | go | func parseCSRExtensions(rawAttributes []asn1.RawValue) ([]pkix.Extension, error) {
// pkcs10Attribute reflects the Attribute structure from section 4.1 of
// https://tools.ietf.org/html/rfc2986.
type pkcs10Attribute struct {
Id asn1.ObjectIdentifier
Values []asn1.RawValue `asn1:"set"`
}
var ret []pkix.Ext... | [
"func",
"parseCSRExtensions",
"(",
"rawAttributes",
"[",
"]",
"asn1",
".",
"RawValue",
")",
"(",
"[",
"]",
"pkix",
".",
"Extension",
",",
"error",
")",
"{",
"// pkcs10Attribute reflects the Attribute structure from section 4.1 of",
"// https://tools.ietf.org/html/rfc2986.",... | // parseCSRExtensions parses the attributes from a CSR and extracts any
// requested extensions. | [
"parseCSRExtensions",
"parses",
"the",
"attributes",
"from",
"a",
"CSR",
"and",
"extracts",
"any",
"requested",
"extensions",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L2188-L2216 |
26,505 | tjfoc/gmsm | sm2/x509.go | ParseCertificateRequest | func ParseCertificateRequest(asn1Data []byte) (*CertificateRequest, error) {
var csr certificateRequest
rest, err := asn1.Unmarshal(asn1Data, &csr)
if err != nil {
return nil, err
} else if len(rest) != 0 {
return nil, asn1.SyntaxError{Msg: "trailing data"}
}
return parseCertificateRequest(&csr)
} | go | func ParseCertificateRequest(asn1Data []byte) (*CertificateRequest, error) {
var csr certificateRequest
rest, err := asn1.Unmarshal(asn1Data, &csr)
if err != nil {
return nil, err
} else if len(rest) != 0 {
return nil, asn1.SyntaxError{Msg: "trailing data"}
}
return parseCertificateRequest(&csr)
} | [
"func",
"ParseCertificateRequest",
"(",
"asn1Data",
"[",
"]",
"byte",
")",
"(",
"*",
"CertificateRequest",
",",
"error",
")",
"{",
"var",
"csr",
"certificateRequest",
"\n\n",
"rest",
",",
"err",
":=",
"asn1",
".",
"Unmarshal",
"(",
"asn1Data",
",",
"&",
"c... | // ParseCertificateRequest parses a single certificate request from the
// given ASN.1 DER data. | [
"ParseCertificateRequest",
"parses",
"a",
"single",
"certificate",
"request",
"from",
"the",
"given",
"ASN",
".",
"1",
"DER",
"data",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L2382-L2393 |
26,506 | tjfoc/gmsm | sm2/x509.go | CheckSignature | func (c *CertificateRequest) CheckSignature() error {
return checkSignature(c.SignatureAlgorithm, c.RawTBSCertificateRequest, c.Signature, c.PublicKey)
} | go | func (c *CertificateRequest) CheckSignature() error {
return checkSignature(c.SignatureAlgorithm, c.RawTBSCertificateRequest, c.Signature, c.PublicKey)
} | [
"func",
"(",
"c",
"*",
"CertificateRequest",
")",
"CheckSignature",
"(",
")",
"error",
"{",
"return",
"checkSignature",
"(",
"c",
".",
"SignatureAlgorithm",
",",
"c",
".",
"RawTBSCertificateRequest",
",",
"c",
".",
"Signature",
",",
"c",
".",
"PublicKey",
")... | // CheckSignature reports whether the signature on c is valid. | [
"CheckSignature",
"reports",
"whether",
"the",
"signature",
"on",
"c",
"is",
"valid",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L2443-L2445 |
26,507 | vmihailenco/msgpack | decode.go | NewDecoder | func NewDecoder(r io.Reader) *Decoder {
d := &Decoder{
buf: makeBuffer(),
}
d.resetReader(r)
return d
} | go | func NewDecoder(r io.Reader) *Decoder {
d := &Decoder{
buf: makeBuffer(),
}
d.resetReader(r)
return d
} | [
"func",
"NewDecoder",
"(",
"r",
"io",
".",
"Reader",
")",
"*",
"Decoder",
"{",
"d",
":=",
"&",
"Decoder",
"{",
"buf",
":",
"makeBuffer",
"(",
")",
",",
"}",
"\n",
"d",
".",
"resetReader",
"(",
"r",
")",
"\n",
"return",
"d",
"\n",
"}"
] | // NewDecoder returns a new decoder that reads from r.
//
// The decoder introduces its own buffering and may read data from r
// beyond the MessagePack values requested. Buffering can be disabled
// by passing a reader that implements io.ByteScanner interface. | [
"NewDecoder",
"returns",
"a",
"new",
"decoder",
"that",
"reads",
"from",
"r",
".",
"The",
"decoder",
"introduces",
"its",
"own",
"buffering",
"and",
"may",
"read",
"data",
"from",
"r",
"beyond",
"the",
"MessagePack",
"values",
"requested",
".",
"Buffering",
... | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/decode.go#L58-L64 |
26,508 | vmihailenco/msgpack | decode.go | UseJSONTag | func (d *Decoder) UseJSONTag(v bool) *Decoder {
d.useJSONTag = v
return d
} | go | func (d *Decoder) UseJSONTag(v bool) *Decoder {
d.useJSONTag = v
return d
} | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"UseJSONTag",
"(",
"v",
"bool",
")",
"*",
"Decoder",
"{",
"d",
".",
"useJSONTag",
"=",
"v",
"\n",
"return",
"d",
"\n",
"}"
] | // UseJSONTag causes the Decoder to use json struct tag as fallback option
// if there is no msgpack tag. | [
"UseJSONTag",
"causes",
"the",
"Decoder",
"to",
"use",
"json",
"struct",
"tag",
"as",
"fallback",
"option",
"if",
"there",
"is",
"no",
"msgpack",
"tag",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/decode.go#L79-L82 |
26,509 | vmihailenco/msgpack | decode.go | Skip | func (d *Decoder) Skip() error {
c, err := d.readCode()
if err != nil {
return err
}
if codes.IsFixedNum(c) {
return nil
} else if codes.IsFixedMap(c) {
return d.skipMap(c)
} else if codes.IsFixedArray(c) {
return d.skipSlice(c)
} else if codes.IsFixedString(c) {
return d.skipBytes(c)
}
switch c {
... | go | func (d *Decoder) Skip() error {
c, err := d.readCode()
if err != nil {
return err
}
if codes.IsFixedNum(c) {
return nil
} else if codes.IsFixedMap(c) {
return d.skipMap(c)
} else if codes.IsFixedArray(c) {
return d.skipSlice(c)
} else if codes.IsFixedString(c) {
return d.skipBytes(c)
}
switch c {
... | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"Skip",
"(",
")",
"error",
"{",
"c",
",",
"err",
":=",
"d",
".",
"readCode",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"codes",
".",
"IsFixedNum",
"(",
"c",
... | // Skip skips next value. | [
"Skip",
"skips",
"next",
"value",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/decode.go#L408-L449 |
26,510 | vmihailenco/msgpack | decode_map.go | DecodeMapLen | func (d *Decoder) DecodeMapLen() (int, error) {
c, err := d.readCode()
if err != nil {
return 0, err
}
if codes.IsExt(c) {
if err = d.skipExtHeader(c); err != nil {
return 0, err
}
c, err = d.readCode()
if err != nil {
return 0, err
}
}
return d.mapLen(c)
} | go | func (d *Decoder) DecodeMapLen() (int, error) {
c, err := d.readCode()
if err != nil {
return 0, err
}
if codes.IsExt(c) {
if err = d.skipExtHeader(c); err != nil {
return 0, err
}
c, err = d.readCode()
if err != nil {
return 0, err
}
}
return d.mapLen(c)
} | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"DecodeMapLen",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"d",
".",
"readCode",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"if... | // DecodeMapLen decodes map length. Length is -1 when map is nil. | [
"DecodeMapLen",
"decodes",
"map",
"length",
".",
"Length",
"is",
"-",
"1",
"when",
"map",
"is",
"nil",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/decode_map.go#L66-L83 |
26,511 | vmihailenco/msgpack | encode.go | StructAsArray | func (e *Encoder) StructAsArray(flag bool) *Encoder {
e.structAsArray = flag
return e
} | go | func (e *Encoder) StructAsArray(flag bool) *Encoder {
e.structAsArray = flag
return e
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"StructAsArray",
"(",
"flag",
"bool",
")",
"*",
"Encoder",
"{",
"e",
".",
"structAsArray",
"=",
"flag",
"\n",
"return",
"e",
"\n",
"}"
] | // StructAsArray causes the Encoder to encode Go structs as MessagePack arrays. | [
"StructAsArray",
"causes",
"the",
"Encoder",
"to",
"encode",
"Go",
"structs",
"as",
"MessagePack",
"arrays",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode.go#L91-L94 |
26,512 | vmihailenco/msgpack | encode.go | UseJSONTag | func (e *Encoder) UseJSONTag(flag bool) *Encoder {
e.useJSONTag = flag
return e
} | go | func (e *Encoder) UseJSONTag(flag bool) *Encoder {
e.useJSONTag = flag
return e
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"UseJSONTag",
"(",
"flag",
"bool",
")",
"*",
"Encoder",
"{",
"e",
".",
"useJSONTag",
"=",
"flag",
"\n",
"return",
"e",
"\n",
"}"
] | // UseJSONTag causes the Encoder to use json struct tag as fallback option
// if there is no msgpack tag. | [
"UseJSONTag",
"causes",
"the",
"Encoder",
"to",
"use",
"json",
"struct",
"tag",
"as",
"fallback",
"option",
"if",
"there",
"is",
"no",
"msgpack",
"tag",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode.go#L98-L101 |
26,513 | vmihailenco/msgpack | encode.go | UseCompactEncoding | func (e *Encoder) UseCompactEncoding(flag bool) *Encoder {
e.useCompact = flag
return e
} | go | func (e *Encoder) UseCompactEncoding(flag bool) *Encoder {
e.useCompact = flag
return e
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"UseCompactEncoding",
"(",
"flag",
"bool",
")",
"*",
"Encoder",
"{",
"e",
".",
"useCompact",
"=",
"flag",
"\n",
"return",
"e",
"\n",
"}"
] | // UseCompactEncoding causes the Encoder to chose the most compact encoding.
// For example, it allows to encode Go int64 as msgpack int8 saving 7 bytes. | [
"UseCompactEncoding",
"causes",
"the",
"Encoder",
"to",
"chose",
"the",
"most",
"compact",
"encoding",
".",
"For",
"example",
"it",
"allows",
"to",
"encode",
"Go",
"int64",
"as",
"msgpack",
"int8",
"saving",
"7",
"bytes",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode.go#L105-L108 |
26,514 | vmihailenco/msgpack | decode_slice.go | DecodeArrayLen | func (d *Decoder) DecodeArrayLen() (int, error) {
c, err := d.readCode()
if err != nil {
return 0, err
}
return d.arrayLen(c)
} | go | func (d *Decoder) DecodeArrayLen() (int, error) {
c, err := d.readCode()
if err != nil {
return 0, err
}
return d.arrayLen(c)
} | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"DecodeArrayLen",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"d",
".",
"readCode",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"re... | // DecodeArrayLen decodes array length. Length is -1 when array is nil. | [
"DecodeArrayLen",
"decodes",
"array",
"length",
".",
"Length",
"is",
"-",
"1",
"when",
"array",
"is",
"nil",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/decode_slice.go#L15-L21 |
26,515 | vmihailenco/msgpack | encode_number.go | EncodeUint8 | func (e *Encoder) EncodeUint8(n uint8) error {
return e.write1(codes.Uint8, n)
} | go | func (e *Encoder) EncodeUint8(n uint8) error {
return e.write1(codes.Uint8, n)
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeUint8",
"(",
"n",
"uint8",
")",
"error",
"{",
"return",
"e",
".",
"write1",
"(",
"codes",
".",
"Uint8",
",",
"n",
")",
"\n",
"}"
] | // EncodeUint8 encodes an uint8 in 2 bytes preserving type of the number. | [
"EncodeUint8",
"encodes",
"an",
"uint8",
"in",
"2",
"bytes",
"preserving",
"type",
"of",
"the",
"number",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L11-L13 |
26,516 | vmihailenco/msgpack | encode_number.go | EncodeUint16 | func (e *Encoder) EncodeUint16(n uint16) error {
return e.write2(codes.Uint16, n)
} | go | func (e *Encoder) EncodeUint16(n uint16) error {
return e.write2(codes.Uint16, n)
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeUint16",
"(",
"n",
"uint16",
")",
"error",
"{",
"return",
"e",
".",
"write2",
"(",
"codes",
".",
"Uint16",
",",
"n",
")",
"\n",
"}"
] | // EncodeUint16 encodes an uint16 in 3 bytes preserving type of the number. | [
"EncodeUint16",
"encodes",
"an",
"uint16",
"in",
"3",
"bytes",
"preserving",
"type",
"of",
"the",
"number",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L23-L25 |
26,517 | vmihailenco/msgpack | encode_number.go | EncodeUint32 | func (e *Encoder) EncodeUint32(n uint32) error {
return e.write4(codes.Uint32, n)
} | go | func (e *Encoder) EncodeUint32(n uint32) error {
return e.write4(codes.Uint32, n)
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeUint32",
"(",
"n",
"uint32",
")",
"error",
"{",
"return",
"e",
".",
"write4",
"(",
"codes",
".",
"Uint32",
",",
"n",
")",
"\n",
"}"
] | // EncodeUint32 encodes an uint16 in 5 bytes preserving type of the number. | [
"EncodeUint32",
"encodes",
"an",
"uint16",
"in",
"5",
"bytes",
"preserving",
"type",
"of",
"the",
"number",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L35-L37 |
26,518 | vmihailenco/msgpack | encode_number.go | EncodeUint64 | func (e *Encoder) EncodeUint64(n uint64) error {
return e.write8(codes.Uint64, n)
} | go | func (e *Encoder) EncodeUint64(n uint64) error {
return e.write8(codes.Uint64, n)
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeUint64",
"(",
"n",
"uint64",
")",
"error",
"{",
"return",
"e",
".",
"write8",
"(",
"codes",
".",
"Uint64",
",",
"n",
")",
"\n",
"}"
] | // EncodeUint64 encodes an uint16 in 9 bytes preserving type of the number. | [
"EncodeUint64",
"encodes",
"an",
"uint16",
"in",
"9",
"bytes",
"preserving",
"type",
"of",
"the",
"number",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L47-L49 |
26,519 | vmihailenco/msgpack | encode_number.go | EncodeInt8 | func (e *Encoder) EncodeInt8(n int8) error {
return e.write1(codes.Int8, uint8(n))
} | go | func (e *Encoder) EncodeInt8(n int8) error {
return e.write1(codes.Int8, uint8(n))
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeInt8",
"(",
"n",
"int8",
")",
"error",
"{",
"return",
"e",
".",
"write1",
"(",
"codes",
".",
"Int8",
",",
"uint8",
"(",
"n",
")",
")",
"\n",
"}"
] | // EncodeInt8 encodes an int8 in 2 bytes preserving type of the number. | [
"EncodeInt8",
"encodes",
"an",
"int8",
"in",
"2",
"bytes",
"preserving",
"type",
"of",
"the",
"number",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L59-L61 |
26,520 | vmihailenco/msgpack | encode_number.go | EncodeInt16 | func (e *Encoder) EncodeInt16(n int16) error {
return e.write2(codes.Int16, uint16(n))
} | go | func (e *Encoder) EncodeInt16(n int16) error {
return e.write2(codes.Int16, uint16(n))
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeInt16",
"(",
"n",
"int16",
")",
"error",
"{",
"return",
"e",
".",
"write2",
"(",
"codes",
".",
"Int16",
",",
"uint16",
"(",
"n",
")",
")",
"\n",
"}"
] | // EncodeInt16 encodes an int16 in 3 bytes preserving type of the number. | [
"EncodeInt16",
"encodes",
"an",
"int16",
"in",
"3",
"bytes",
"preserving",
"type",
"of",
"the",
"number",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L71-L73 |
26,521 | vmihailenco/msgpack | encode_number.go | EncodeInt32 | func (e *Encoder) EncodeInt32(n int32) error {
return e.write4(codes.Int32, uint32(n))
} | go | func (e *Encoder) EncodeInt32(n int32) error {
return e.write4(codes.Int32, uint32(n))
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeInt32",
"(",
"n",
"int32",
")",
"error",
"{",
"return",
"e",
".",
"write4",
"(",
"codes",
".",
"Int32",
",",
"uint32",
"(",
"n",
")",
")",
"\n",
"}"
] | // EncodeInt32 encodes an int32 in 5 bytes preserving type of the number. | [
"EncodeInt32",
"encodes",
"an",
"int32",
"in",
"5",
"bytes",
"preserving",
"type",
"of",
"the",
"number",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L83-L85 |
26,522 | vmihailenco/msgpack | encode_number.go | EncodeInt64 | func (e *Encoder) EncodeInt64(n int64) error {
return e.write8(codes.Int64, uint64(n))
} | go | func (e *Encoder) EncodeInt64(n int64) error {
return e.write8(codes.Int64, uint64(n))
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeInt64",
"(",
"n",
"int64",
")",
"error",
"{",
"return",
"e",
".",
"write8",
"(",
"codes",
".",
"Int64",
",",
"uint64",
"(",
"n",
")",
")",
"\n",
"}"
] | // EncodeInt64 encodes an int64 in 9 bytes preserving type of the number. | [
"EncodeInt64",
"encodes",
"an",
"int64",
"in",
"9",
"bytes",
"preserving",
"type",
"of",
"the",
"number",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L95-L97 |
26,523 | vmihailenco/msgpack | encode_number.go | EncodeUint | func (e *Encoder) EncodeUint(n uint64) error {
if n <= math.MaxInt8 {
return e.w.WriteByte(byte(n))
}
if n <= math.MaxUint8 {
return e.EncodeUint8(uint8(n))
}
if n <= math.MaxUint16 {
return e.EncodeUint16(uint16(n))
}
if n <= math.MaxUint32 {
return e.EncodeUint32(uint32(n))
}
return e.EncodeUint64(ui... | go | func (e *Encoder) EncodeUint(n uint64) error {
if n <= math.MaxInt8 {
return e.w.WriteByte(byte(n))
}
if n <= math.MaxUint8 {
return e.EncodeUint8(uint8(n))
}
if n <= math.MaxUint16 {
return e.EncodeUint16(uint16(n))
}
if n <= math.MaxUint32 {
return e.EncodeUint32(uint32(n))
}
return e.EncodeUint64(ui... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeUint",
"(",
"n",
"uint64",
")",
"error",
"{",
"if",
"n",
"<=",
"math",
".",
"MaxInt8",
"{",
"return",
"e",
".",
"w",
".",
"WriteByte",
"(",
"byte",
"(",
"n",
")",
")",
"\n",
"}",
"\n",
"if",
"n",
... | // EncodeUnsignedNumber encodes an uint64 in 1, 2, 3, 5, or 9 bytes.
// Type of the number is lost during encoding. | [
"EncodeUnsignedNumber",
"encodes",
"an",
"uint64",
"in",
"1",
"2",
"3",
"5",
"or",
"9",
"bytes",
".",
"Type",
"of",
"the",
"number",
"is",
"lost",
"during",
"encoding",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L108-L122 |
26,524 | vmihailenco/msgpack | encode_number.go | EncodeInt | func (e *Encoder) EncodeInt(n int64) error {
if n >= 0 {
return e.EncodeUint(uint64(n))
}
if n >= int64(int8(codes.NegFixedNumLow)) {
return e.w.WriteByte(byte(n))
}
if n >= math.MinInt8 {
return e.EncodeInt8(int8(n))
}
if n >= math.MinInt16 {
return e.EncodeInt16(int16(n))
}
if n >= math.MinInt32 {
... | go | func (e *Encoder) EncodeInt(n int64) error {
if n >= 0 {
return e.EncodeUint(uint64(n))
}
if n >= int64(int8(codes.NegFixedNumLow)) {
return e.w.WriteByte(byte(n))
}
if n >= math.MinInt8 {
return e.EncodeInt8(int8(n))
}
if n >= math.MinInt16 {
return e.EncodeInt16(int16(n))
}
if n >= math.MinInt32 {
... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"EncodeInt",
"(",
"n",
"int64",
")",
"error",
"{",
"if",
"n",
">=",
"0",
"{",
"return",
"e",
".",
"EncodeUint",
"(",
"uint64",
"(",
"n",
")",
")",
"\n",
"}",
"\n",
"if",
"n",
">=",
"int64",
"(",
"int8",
... | // EncodeNumber encodes an int64 in 1, 2, 3, 5, or 9 bytes.
// Type of number is lost during encoding. | [
"EncodeNumber",
"encodes",
"an",
"int64",
"in",
"1",
"2",
"3",
"5",
"or",
"9",
"bytes",
".",
"Type",
"of",
"number",
"is",
"lost",
"during",
"encoding",
"."
] | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/encode_number.go#L126-L143 |
26,525 | vmihailenco/msgpack | ext.go | RegisterExt | func RegisterExt(id int8, value interface{}) {
typ := reflect.TypeOf(value)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
}
ptr := reflect.PtrTo(typ)
if _, ok := extTypes[id]; ok {
panic(fmt.Errorf("msgpack: ext with id=%d is already registered", id))
}
registerExt(id, ptr, getEncoder(ptr), getDecoder(pt... | go | func RegisterExt(id int8, value interface{}) {
typ := reflect.TypeOf(value)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
}
ptr := reflect.PtrTo(typ)
if _, ok := extTypes[id]; ok {
panic(fmt.Errorf("msgpack: ext with id=%d is already registered", id))
}
registerExt(id, ptr, getEncoder(ptr), getDecoder(pt... | [
"func",
"RegisterExt",
"(",
"id",
"int8",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"typ",
":=",
"reflect",
".",
"TypeOf",
"(",
"value",
")",
"\n",
"if",
"typ",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"typ",
"=",
"typ",
".",... | // RegisterExt records a type, identified by a value for that type,
// under the provided id. That id will identify the concrete type of a value
// sent or received as an interface variable. Only types that will be
// transferred as implementations of interface values need to be registered.
// Expecting to be used only... | [
"RegisterExt",
"records",
"a",
"type",
"identified",
"by",
"a",
"value",
"for",
"that",
"type",
"under",
"the",
"provided",
"id",
".",
"That",
"id",
"will",
"identify",
"the",
"concrete",
"type",
"of",
"a",
"value",
"sent",
"or",
"received",
"as",
"an",
... | 5467b4fb032b68b160f4acce954153280cf5e05b | https://github.com/vmihailenco/msgpack/blob/5467b4fb032b68b160f4acce954153280cf5e05b/ext.go#L31-L44 |
26,526 | minio/minio-go | bucket-notification.go | NewArn | func NewArn(partition, service, region, accountID, resource string) Arn {
return Arn{Partition: partition,
Service: service,
Region: region,
AccountID: accountID,
Resource: resource}
} | go | func NewArn(partition, service, region, accountID, resource string) Arn {
return Arn{Partition: partition,
Service: service,
Region: region,
AccountID: accountID,
Resource: resource}
} | [
"func",
"NewArn",
"(",
"partition",
",",
"service",
",",
"region",
",",
"accountID",
",",
"resource",
"string",
")",
"Arn",
"{",
"return",
"Arn",
"{",
"Partition",
":",
"partition",
",",
"Service",
":",
"service",
",",
"Region",
":",
"region",
",",
"Acco... | // NewArn creates new ARN based on the given partition, service, region, account id and resource | [
"NewArn",
"creates",
"new",
"ARN",
"based",
"on",
"the",
"given",
"partition",
"service",
"region",
"account",
"id",
"and",
"resource"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L76-L82 |
26,527 | minio/minio-go | bucket-notification.go | String | func (arn Arn) String() string {
return "arn:" + arn.Partition + ":" + arn.Service + ":" + arn.Region + ":" + arn.AccountID + ":" + arn.Resource
} | go | func (arn Arn) String() string {
return "arn:" + arn.Partition + ":" + arn.Service + ":" + arn.Region + ":" + arn.AccountID + ":" + arn.Resource
} | [
"func",
"(",
"arn",
"Arn",
")",
"String",
"(",
")",
"string",
"{",
"return",
"\"",
"\"",
"+",
"arn",
".",
"Partition",
"+",
"\"",
"\"",
"+",
"arn",
".",
"Service",
"+",
"\"",
"\"",
"+",
"arn",
".",
"Region",
"+",
"\"",
"\"",
"+",
"arn",
".",
... | // Return the string format of the ARN | [
"Return",
"the",
"string",
"format",
"of",
"the",
"ARN"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L85-L87 |
26,528 | minio/minio-go | bucket-notification.go | AddEvents | func (t *NotificationConfig) AddEvents(events ...NotificationEventType) {
t.Events = append(t.Events, events...)
} | go | func (t *NotificationConfig) AddEvents(events ...NotificationEventType) {
t.Events = append(t.Events, events...)
} | [
"func",
"(",
"t",
"*",
"NotificationConfig",
")",
"AddEvents",
"(",
"events",
"...",
"NotificationEventType",
")",
"{",
"t",
".",
"Events",
"=",
"append",
"(",
"t",
".",
"Events",
",",
"events",
"...",
")",
"\n",
"}"
] | // AddEvents adds one event to the current notification config | [
"AddEvents",
"adds",
"one",
"event",
"to",
"the",
"current",
"notification",
"config"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L104-L106 |
26,529 | minio/minio-go | bucket-notification.go | AddFilterSuffix | func (t *NotificationConfig) AddFilterSuffix(suffix string) {
if t.Filter == nil {
t.Filter = &Filter{}
}
newFilterRule := FilterRule{Name: "suffix", Value: suffix}
// Replace any suffix rule if existing and add to the list otherwise
for index := range t.Filter.S3Key.FilterRules {
if t.Filter.S3Key.FilterRules... | go | func (t *NotificationConfig) AddFilterSuffix(suffix string) {
if t.Filter == nil {
t.Filter = &Filter{}
}
newFilterRule := FilterRule{Name: "suffix", Value: suffix}
// Replace any suffix rule if existing and add to the list otherwise
for index := range t.Filter.S3Key.FilterRules {
if t.Filter.S3Key.FilterRules... | [
"func",
"(",
"t",
"*",
"NotificationConfig",
")",
"AddFilterSuffix",
"(",
"suffix",
"string",
")",
"{",
"if",
"t",
".",
"Filter",
"==",
"nil",
"{",
"t",
".",
"Filter",
"=",
"&",
"Filter",
"{",
"}",
"\n",
"}",
"\n",
"newFilterRule",
":=",
"FilterRule",
... | // AddFilterSuffix sets the suffix configuration to the current notification config | [
"AddFilterSuffix",
"sets",
"the",
"suffix",
"configuration",
"to",
"the",
"current",
"notification",
"config"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L109-L122 |
26,530 | minio/minio-go | bucket-notification.go | AddFilterPrefix | func (t *NotificationConfig) AddFilterPrefix(prefix string) {
if t.Filter == nil {
t.Filter = &Filter{}
}
newFilterRule := FilterRule{Name: "prefix", Value: prefix}
// Replace any prefix rule if existing and add to the list otherwise
for index := range t.Filter.S3Key.FilterRules {
if t.Filter.S3Key.FilterRules... | go | func (t *NotificationConfig) AddFilterPrefix(prefix string) {
if t.Filter == nil {
t.Filter = &Filter{}
}
newFilterRule := FilterRule{Name: "prefix", Value: prefix}
// Replace any prefix rule if existing and add to the list otherwise
for index := range t.Filter.S3Key.FilterRules {
if t.Filter.S3Key.FilterRules... | [
"func",
"(",
"t",
"*",
"NotificationConfig",
")",
"AddFilterPrefix",
"(",
"prefix",
"string",
")",
"{",
"if",
"t",
".",
"Filter",
"==",
"nil",
"{",
"t",
".",
"Filter",
"=",
"&",
"Filter",
"{",
"}",
"\n",
"}",
"\n",
"newFilterRule",
":=",
"FilterRule",
... | // AddFilterPrefix sets the prefix configuration to the current notification config | [
"AddFilterPrefix",
"sets",
"the",
"prefix",
"configuration",
"to",
"the",
"current",
"notification",
"config"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L125-L138 |
26,531 | minio/minio-go | bucket-notification.go | AddTopic | func (b *BucketNotification) AddTopic(topicConfig NotificationConfig) bool {
newTopicConfig := TopicConfig{NotificationConfig: topicConfig, Topic: topicConfig.Arn.String()}
for _, n := range b.TopicConfigs {
// If new config matches existing one
if n.Topic == newTopicConfig.Arn.String() && newTopicConfig.Filter =... | go | func (b *BucketNotification) AddTopic(topicConfig NotificationConfig) bool {
newTopicConfig := TopicConfig{NotificationConfig: topicConfig, Topic: topicConfig.Arn.String()}
for _, n := range b.TopicConfigs {
// If new config matches existing one
if n.Topic == newTopicConfig.Arn.String() && newTopicConfig.Filter =... | [
"func",
"(",
"b",
"*",
"BucketNotification",
")",
"AddTopic",
"(",
"topicConfig",
"NotificationConfig",
")",
"bool",
"{",
"newTopicConfig",
":=",
"TopicConfig",
"{",
"NotificationConfig",
":",
"topicConfig",
",",
"Topic",
":",
"topicConfig",
".",
"Arn",
".",
"St... | // AddTopic adds a given topic config to the general bucket notification config | [
"AddTopic",
"adds",
"a",
"given",
"topic",
"config",
"to",
"the",
"general",
"bucket",
"notification",
"config"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L167-L190 |
26,532 | minio/minio-go | bucket-notification.go | AddQueue | func (b *BucketNotification) AddQueue(queueConfig NotificationConfig) bool {
newQueueConfig := QueueConfig{NotificationConfig: queueConfig, Queue: queueConfig.Arn.String()}
for _, n := range b.QueueConfigs {
if n.Queue == newQueueConfig.Arn.String() && newQueueConfig.Filter == n.Filter {
existingConfig := set.N... | go | func (b *BucketNotification) AddQueue(queueConfig NotificationConfig) bool {
newQueueConfig := QueueConfig{NotificationConfig: queueConfig, Queue: queueConfig.Arn.String()}
for _, n := range b.QueueConfigs {
if n.Queue == newQueueConfig.Arn.String() && newQueueConfig.Filter == n.Filter {
existingConfig := set.N... | [
"func",
"(",
"b",
"*",
"BucketNotification",
")",
"AddQueue",
"(",
"queueConfig",
"NotificationConfig",
")",
"bool",
"{",
"newQueueConfig",
":=",
"QueueConfig",
"{",
"NotificationConfig",
":",
"queueConfig",
",",
"Queue",
":",
"queueConfig",
".",
"Arn",
".",
"St... | // AddQueue adds a given queue config to the general bucket notification config | [
"AddQueue",
"adds",
"a",
"given",
"queue",
"config",
"to",
"the",
"general",
"bucket",
"notification",
"config"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L193-L215 |
26,533 | minio/minio-go | bucket-notification.go | AddLambda | func (b *BucketNotification) AddLambda(lambdaConfig NotificationConfig) bool {
newLambdaConfig := LambdaConfig{NotificationConfig: lambdaConfig, Lambda: lambdaConfig.Arn.String()}
for _, n := range b.LambdaConfigs {
if n.Lambda == newLambdaConfig.Arn.String() && newLambdaConfig.Filter == n.Filter {
existingConf... | go | func (b *BucketNotification) AddLambda(lambdaConfig NotificationConfig) bool {
newLambdaConfig := LambdaConfig{NotificationConfig: lambdaConfig, Lambda: lambdaConfig.Arn.String()}
for _, n := range b.LambdaConfigs {
if n.Lambda == newLambdaConfig.Arn.String() && newLambdaConfig.Filter == n.Filter {
existingConf... | [
"func",
"(",
"b",
"*",
"BucketNotification",
")",
"AddLambda",
"(",
"lambdaConfig",
"NotificationConfig",
")",
"bool",
"{",
"newLambdaConfig",
":=",
"LambdaConfig",
"{",
"NotificationConfig",
":",
"lambdaConfig",
",",
"Lambda",
":",
"lambdaConfig",
".",
"Arn",
"."... | // AddLambda adds a given lambda config to the general bucket notification config | [
"AddLambda",
"adds",
"a",
"given",
"lambda",
"config",
"to",
"the",
"general",
"bucket",
"notification",
"config"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L218-L240 |
26,534 | minio/minio-go | bucket-notification.go | RemoveTopicByArn | func (b *BucketNotification) RemoveTopicByArn(arn Arn) {
var topics []TopicConfig
for _, topic := range b.TopicConfigs {
if topic.Topic != arn.String() {
topics = append(topics, topic)
}
}
b.TopicConfigs = topics
} | go | func (b *BucketNotification) RemoveTopicByArn(arn Arn) {
var topics []TopicConfig
for _, topic := range b.TopicConfigs {
if topic.Topic != arn.String() {
topics = append(topics, topic)
}
}
b.TopicConfigs = topics
} | [
"func",
"(",
"b",
"*",
"BucketNotification",
")",
"RemoveTopicByArn",
"(",
"arn",
"Arn",
")",
"{",
"var",
"topics",
"[",
"]",
"TopicConfig",
"\n",
"for",
"_",
",",
"topic",
":=",
"range",
"b",
".",
"TopicConfigs",
"{",
"if",
"topic",
".",
"Topic",
"!="... | // RemoveTopicByArn removes all topic configurations that match the exact specified ARN | [
"RemoveTopicByArn",
"removes",
"all",
"topic",
"configurations",
"that",
"match",
"the",
"exact",
"specified",
"ARN"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L243-L251 |
26,535 | minio/minio-go | bucket-notification.go | RemoveQueueByArn | func (b *BucketNotification) RemoveQueueByArn(arn Arn) {
var queues []QueueConfig
for _, queue := range b.QueueConfigs {
if queue.Queue != arn.String() {
queues = append(queues, queue)
}
}
b.QueueConfigs = queues
} | go | func (b *BucketNotification) RemoveQueueByArn(arn Arn) {
var queues []QueueConfig
for _, queue := range b.QueueConfigs {
if queue.Queue != arn.String() {
queues = append(queues, queue)
}
}
b.QueueConfigs = queues
} | [
"func",
"(",
"b",
"*",
"BucketNotification",
")",
"RemoveQueueByArn",
"(",
"arn",
"Arn",
")",
"{",
"var",
"queues",
"[",
"]",
"QueueConfig",
"\n",
"for",
"_",
",",
"queue",
":=",
"range",
"b",
".",
"QueueConfigs",
"{",
"if",
"queue",
".",
"Queue",
"!="... | // RemoveQueueByArn removes all queue configurations that match the exact specified ARN | [
"RemoveQueueByArn",
"removes",
"all",
"queue",
"configurations",
"that",
"match",
"the",
"exact",
"specified",
"ARN"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L254-L262 |
26,536 | minio/minio-go | bucket-notification.go | RemoveLambdaByArn | func (b *BucketNotification) RemoveLambdaByArn(arn Arn) {
var lambdas []LambdaConfig
for _, lambda := range b.LambdaConfigs {
if lambda.Lambda != arn.String() {
lambdas = append(lambdas, lambda)
}
}
b.LambdaConfigs = lambdas
} | go | func (b *BucketNotification) RemoveLambdaByArn(arn Arn) {
var lambdas []LambdaConfig
for _, lambda := range b.LambdaConfigs {
if lambda.Lambda != arn.String() {
lambdas = append(lambdas, lambda)
}
}
b.LambdaConfigs = lambdas
} | [
"func",
"(",
"b",
"*",
"BucketNotification",
")",
"RemoveLambdaByArn",
"(",
"arn",
"Arn",
")",
"{",
"var",
"lambdas",
"[",
"]",
"LambdaConfig",
"\n",
"for",
"_",
",",
"lambda",
":=",
"range",
"b",
".",
"LambdaConfigs",
"{",
"if",
"lambda",
".",
"Lambda",... | // RemoveLambdaByArn removes all lambda configurations that match the exact specified ARN | [
"RemoveLambdaByArn",
"removes",
"all",
"lambda",
"configurations",
"that",
"match",
"the",
"exact",
"specified",
"ARN"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-notification.go#L265-L273 |
26,537 | minio/minio-go | retry.go | newRetryTimer | func (c Client) newRetryTimer(maxRetry int, unit time.Duration, cap time.Duration, jitter float64, doneCh chan struct{}) <-chan int {
attemptCh := make(chan int)
// computes the exponential backoff duration according to
// https://www.awsarchitectureblog.com/2015/03/backoff.html
exponentialBackoffWait := func(atte... | go | func (c Client) newRetryTimer(maxRetry int, unit time.Duration, cap time.Duration, jitter float64, doneCh chan struct{}) <-chan int {
attemptCh := make(chan int)
// computes the exponential backoff duration according to
// https://www.awsarchitectureblog.com/2015/03/backoff.html
exponentialBackoffWait := func(atte... | [
"func",
"(",
"c",
"Client",
")",
"newRetryTimer",
"(",
"maxRetry",
"int",
",",
"unit",
"time",
".",
"Duration",
",",
"cap",
"time",
".",
"Duration",
",",
"jitter",
"float64",
",",
"doneCh",
"chan",
"struct",
"{",
"}",
")",
"<-",
"chan",
"int",
"{",
"... | // newRetryTimer creates a timer with exponentially increasing
// delays until the maximum retry attempts are reached. | [
"newRetryTimer",
"creates",
"a",
"timer",
"with",
"exponentially",
"increasing",
"delays",
"until",
"the",
"maximum",
"retry",
"attempts",
"are",
"reached",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/retry.go#L47-L86 |
26,538 | minio/minio-go | retry.go | isS3CodeRetryable | func isS3CodeRetryable(s3Code string) (ok bool) {
_, ok = retryableS3Codes[s3Code]
return ok
} | go | func isS3CodeRetryable(s3Code string) (ok bool) {
_, ok = retryableS3Codes[s3Code]
return ok
} | [
"func",
"isS3CodeRetryable",
"(",
"s3Code",
"string",
")",
"(",
"ok",
"bool",
")",
"{",
"_",
",",
"ok",
"=",
"retryableS3Codes",
"[",
"s3Code",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] | // isS3CodeRetryable - is s3 error code retryable. | [
"isS3CodeRetryable",
"-",
"is",
"s3",
"error",
"code",
"retryable",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/retry.go#L135-L138 |
26,539 | minio/minio-go | retry.go | isHTTPStatusRetryable | func isHTTPStatusRetryable(httpStatusCode int) (ok bool) {
_, ok = retryableHTTPStatusCodes[httpStatusCode]
return ok
} | go | func isHTTPStatusRetryable(httpStatusCode int) (ok bool) {
_, ok = retryableHTTPStatusCodes[httpStatusCode]
return ok
} | [
"func",
"isHTTPStatusRetryable",
"(",
"httpStatusCode",
"int",
")",
"(",
"ok",
"bool",
")",
"{",
"_",
",",
"ok",
"=",
"retryableHTTPStatusCodes",
"[",
"httpStatusCode",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] | // isHTTPStatusRetryable - is HTTP error code retryable. | [
"isHTTPStatusRetryable",
"-",
"is",
"HTTP",
"error",
"code",
"retryable",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/retry.go#L150-L153 |
26,540 | minio/minio-go | api-put-object-multipart.go | initiateMultipartUpload | func (c Client) initiateMultipartUpload(ctx context.Context, bucketName, objectName string, opts PutObjectOptions) (initiateMultipartUploadResult, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return initiateMultipartUploadResult{}, err
}
if err := s3utils.CheckVal... | go | func (c Client) initiateMultipartUpload(ctx context.Context, bucketName, objectName string, opts PutObjectOptions) (initiateMultipartUploadResult, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return initiateMultipartUploadResult{}, err
}
if err := s3utils.CheckVal... | [
"func",
"(",
"c",
"Client",
")",
"initiateMultipartUpload",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucketName",
",",
"objectName",
"string",
",",
"opts",
"PutObjectOptions",
")",
"(",
"initiateMultipartUploadResult",
",",
"error",
")",
"{",
"// Input validat... | // initiateMultipartUpload - Initiates a multipart upload and returns an upload ID. | [
"initiateMultipartUpload",
"-",
"Initiates",
"a",
"multipart",
"upload",
"and",
"returns",
"an",
"upload",
"ID",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object-multipart.go#L187-L228 |
26,541 | minio/minio-go | api-put-object-multipart.go | uploadPart | func (c Client) uploadPart(ctx context.Context, bucketName, objectName, uploadID string, reader io.Reader,
partNumber int, md5Base64, sha256Hex string, size int64, sse encrypt.ServerSide) (ObjectPart, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return ObjectPart{}... | go | func (c Client) uploadPart(ctx context.Context, bucketName, objectName, uploadID string, reader io.Reader,
partNumber int, md5Base64, sha256Hex string, size int64, sse encrypt.ServerSide) (ObjectPart, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return ObjectPart{}... | [
"func",
"(",
"c",
"Client",
")",
"uploadPart",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucketName",
",",
"objectName",
",",
"uploadID",
"string",
",",
"reader",
"io",
".",
"Reader",
",",
"partNumber",
"int",
",",
"md5Base64",
",",
"sha256Hex",
"string... | // uploadPart - Uploads a part in a multipart upload. | [
"uploadPart",
"-",
"Uploads",
"a",
"part",
"in",
"a",
"multipart",
"upload",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object-multipart.go#L231-L300 |
26,542 | minio/minio-go | api-put-object-multipart.go | completeMultipartUpload | func (c Client) completeMultipartUpload(ctx context.Context, bucketName, objectName, uploadID string,
complete completeMultipartUpload) (completeMultipartUploadResult, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return completeMultipartUploadResult{}, err
}
if e... | go | func (c Client) completeMultipartUpload(ctx context.Context, bucketName, objectName, uploadID string,
complete completeMultipartUpload) (completeMultipartUploadResult, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return completeMultipartUploadResult{}, err
}
if e... | [
"func",
"(",
"c",
"Client",
")",
"completeMultipartUpload",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucketName",
",",
"objectName",
",",
"uploadID",
"string",
",",
"complete",
"completeMultipartUpload",
")",
"(",
"completeMultipartUploadResult",
",",
"error",
... | // completeMultipartUpload - Completes a multipart upload by assembling previously uploaded parts. | [
"completeMultipartUpload",
"-",
"Completes",
"a",
"multipart",
"upload",
"by",
"assembling",
"previously",
"uploaded",
"parts",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object-multipart.go#L303-L372 |
26,543 | minio/minio-go | api-select.go | Header | func (o SelectObjectOptions) Header() http.Header {
headers := make(http.Header)
if o.ServerSideEncryption != nil && o.ServerSideEncryption.Type() == encrypt.SSEC {
o.ServerSideEncryption.Marshal(headers)
}
return headers
} | go | func (o SelectObjectOptions) Header() http.Header {
headers := make(http.Header)
if o.ServerSideEncryption != nil && o.ServerSideEncryption.Type() == encrypt.SSEC {
o.ServerSideEncryption.Marshal(headers)
}
return headers
} | [
"func",
"(",
"o",
"SelectObjectOptions",
")",
"Header",
"(",
")",
"http",
".",
"Header",
"{",
"headers",
":=",
"make",
"(",
"http",
".",
"Header",
")",
"\n",
"if",
"o",
".",
"ServerSideEncryption",
"!=",
"nil",
"&&",
"o",
".",
"ServerSideEncryption",
"."... | // Header returns the http.Header representation of the SelectObject options. | [
"Header",
"returns",
"the",
"http",
".",
"Header",
"representation",
"of",
"the",
"SelectObject",
"options",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L146-L152 |
26,544 | minio/minio-go | api-select.go | Close | func (s *SelectResults) Close() error {
defer closeResponse(s.resp)
return s.pipeReader.Close()
} | go | func (s *SelectResults) Close() error {
defer closeResponse(s.resp)
return s.pipeReader.Close()
} | [
"func",
"(",
"s",
"*",
"SelectResults",
")",
"Close",
"(",
")",
"error",
"{",
"defer",
"closeResponse",
"(",
"s",
".",
"resp",
")",
"\n",
"return",
"s",
".",
"pipeReader",
".",
"Close",
"(",
")",
"\n",
"}"
] | // Close - closes the underlying response body and the stream reader. | [
"Close",
"-",
"closes",
"the",
"underlying",
"response",
"body",
"and",
"the",
"stream",
"reader",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L270-L273 |
26,545 | minio/minio-go | api-select.go | Read | func (s *SelectResults) Read(b []byte) (n int, err error) {
return s.pipeReader.Read(b)
} | go | func (s *SelectResults) Read(b []byte) (n int, err error) {
return s.pipeReader.Read(b)
} | [
"func",
"(",
"s",
"*",
"SelectResults",
")",
"Read",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"s",
".",
"pipeReader",
".",
"Read",
"(",
"b",
")",
"\n",
"}"
] | // Read - is a reader compatible implementation for SelectObjectContent records. | [
"Read",
"-",
"is",
"a",
"reader",
"compatible",
"implementation",
"for",
"SelectObjectContent",
"records",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L276-L278 |
26,546 | minio/minio-go | api-select.go | start | func (s *SelectResults) start(pipeWriter *io.PipeWriter) {
go func() {
for {
var prelude preludeInfo
var headers = make(http.Header)
var err error
// Create CRC code
crc := crc32.New(crc32.IEEETable)
crcReader := io.TeeReader(s.resp.Body, crc)
// Extract the prelude(12 bytes) into a struct to ... | go | func (s *SelectResults) start(pipeWriter *io.PipeWriter) {
go func() {
for {
var prelude preludeInfo
var headers = make(http.Header)
var err error
// Create CRC code
crc := crc32.New(crc32.IEEETable)
crcReader := io.TeeReader(s.resp.Body, crc)
// Extract the prelude(12 bytes) into a struct to ... | [
"func",
"(",
"s",
"*",
"SelectResults",
")",
"start",
"(",
"pipeWriter",
"*",
"io",
".",
"PipeWriter",
")",
"{",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"var",
"prelude",
"preludeInfo",
"\n",
"var",
"headers",
"=",
"make",
"(",
"http",
".",
"Header"... | // start is the main function that decodes the large byte array into
// several events that are sent through the eventstream. | [
"start",
"is",
"the",
"main",
"function",
"that",
"decodes",
"the",
"large",
"byte",
"array",
"into",
"several",
"events",
"that",
"are",
"sent",
"through",
"the",
"eventstream",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L292-L389 |
26,547 | minio/minio-go | api-select.go | processPrelude | func processPrelude(prelude io.Reader, crc hash.Hash32) (preludeInfo, error) {
var err error
var pInfo = preludeInfo{}
// reads total length of the message (first 4 bytes)
pInfo.totalLen, err = extractUint32(prelude)
if err != nil {
return pInfo, err
}
// reads total header length of the message (2nd 4 bytes... | go | func processPrelude(prelude io.Reader, crc hash.Hash32) (preludeInfo, error) {
var err error
var pInfo = preludeInfo{}
// reads total length of the message (first 4 bytes)
pInfo.totalLen, err = extractUint32(prelude)
if err != nil {
return pInfo, err
}
// reads total header length of the message (2nd 4 bytes... | [
"func",
"processPrelude",
"(",
"prelude",
"io",
".",
"Reader",
",",
"crc",
"hash",
".",
"Hash32",
")",
"(",
"preludeInfo",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"var",
"pInfo",
"=",
"preludeInfo",
"{",
"}",
"\n\n",
"// reads total length of ... | // processPrelude is the function that reads the 12 bytes of the prelude and
// ensures the CRC is correct while also extracting relevant information into
// the struct, | [
"processPrelude",
"is",
"the",
"function",
"that",
"reads",
"the",
"12",
"bytes",
"of",
"the",
"prelude",
"and",
"ensures",
"the",
"CRC",
"is",
"correct",
"while",
"also",
"extracting",
"relevant",
"information",
"into",
"the",
"struct"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L399-L422 |
26,548 | minio/minio-go | api-select.go | extractHeader | func extractHeader(body io.Reader, myHeaders http.Header) error {
for {
// extracts the first part of the header,
headerTypeName, err := extractHeaderType(body)
if err != nil {
// Since end of file, we have read all of our headers
if err == io.EOF {
break
}
return err
}
// reads the 7 presen... | go | func extractHeader(body io.Reader, myHeaders http.Header) error {
for {
// extracts the first part of the header,
headerTypeName, err := extractHeaderType(body)
if err != nil {
// Since end of file, we have read all of our headers
if err == io.EOF {
break
}
return err
}
// reads the 7 presen... | [
"func",
"extractHeader",
"(",
"body",
"io",
".",
"Reader",
",",
"myHeaders",
"http",
".",
"Header",
")",
"error",
"{",
"for",
"{",
"// extracts the first part of the header,",
"headerTypeName",
",",
"err",
":=",
"extractHeaderType",
"(",
"body",
")",
"\n",
"if",... | // extracts the relevant information from the Headers. | [
"extracts",
"the",
"relevant",
"information",
"from",
"the",
"Headers",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L425-L449 |
26,549 | minio/minio-go | api-select.go | extractHeaderType | func extractHeaderType(body io.Reader) (string, error) {
// extracts 2 bit integer
headerNameLen, err := extractUint8(body)
if err != nil {
return "", err
}
// extracts the string with the appropriate number of bytes
headerName, err := extractString(body, int(headerNameLen))
if err != nil {
return "", err
}... | go | func extractHeaderType(body io.Reader) (string, error) {
// extracts 2 bit integer
headerNameLen, err := extractUint8(body)
if err != nil {
return "", err
}
// extracts the string with the appropriate number of bytes
headerName, err := extractString(body, int(headerNameLen))
if err != nil {
return "", err
}... | [
"func",
"extractHeaderType",
"(",
"body",
"io",
".",
"Reader",
")",
"(",
"string",
",",
"error",
")",
"{",
"// extracts 2 bit integer",
"headerNameLen",
",",
"err",
":=",
"extractUint8",
"(",
"body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\""... | // extractHeaderType extracts the first half of the header message, the header type. | [
"extractHeaderType",
"extracts",
"the",
"first",
"half",
"of",
"the",
"header",
"message",
"the",
"header",
"type",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L452-L464 |
26,550 | minio/minio-go | api-select.go | extractHeaderValue | func extractHeaderValue(body io.Reader) (string, error) {
bodyLen, err := extractUint16(body)
if err != nil {
return "", err
}
bodyName, err := extractString(body, int(bodyLen))
if err != nil {
return "", err
}
return bodyName, nil
} | go | func extractHeaderValue(body io.Reader) (string, error) {
bodyLen, err := extractUint16(body)
if err != nil {
return "", err
}
bodyName, err := extractString(body, int(bodyLen))
if err != nil {
return "", err
}
return bodyName, nil
} | [
"func",
"extractHeaderValue",
"(",
"body",
"io",
".",
"Reader",
")",
"(",
"string",
",",
"error",
")",
"{",
"bodyLen",
",",
"err",
":=",
"extractUint16",
"(",
"body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
... | // extractsHeaderValue extracts the second half of the header message, the
// header value | [
"extractsHeaderValue",
"extracts",
"the",
"second",
"half",
"of",
"the",
"header",
"message",
"the",
"header",
"value"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L468-L478 |
26,551 | minio/minio-go | api-select.go | extractString | func extractString(source io.Reader, lenBytes int) (string, error) {
myVal := make([]byte, lenBytes)
_, err := source.Read(myVal)
if err != nil {
return "", err
}
return string(myVal), nil
} | go | func extractString(source io.Reader, lenBytes int) (string, error) {
myVal := make([]byte, lenBytes)
_, err := source.Read(myVal)
if err != nil {
return "", err
}
return string(myVal), nil
} | [
"func",
"extractString",
"(",
"source",
"io",
".",
"Reader",
",",
"lenBytes",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"myVal",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"lenBytes",
")",
"\n",
"_",
",",
"err",
":=",
"source",
".",
"Read",... | // extracts a string from byte array of a particular number of bytes. | [
"extracts",
"a",
"string",
"from",
"byte",
"array",
"of",
"a",
"particular",
"number",
"of",
"bytes",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L481-L488 |
26,552 | minio/minio-go | api-select.go | extractUint32 | func extractUint32(r io.Reader) (uint32, error) {
buf := make([]byte, 4)
_, err := io.ReadFull(r, buf)
if err != nil {
return 0, err
}
return binary.BigEndian.Uint32(buf), nil
} | go | func extractUint32(r io.Reader) (uint32, error) {
buf := make([]byte, 4)
_, err := io.ReadFull(r, buf)
if err != nil {
return 0, err
}
return binary.BigEndian.Uint32(buf), nil
} | [
"func",
"extractUint32",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"uint32",
",",
"error",
")",
"{",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"4",
")",
"\n",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"r",
",",
"buf",
")",
"\n"... | // extractUint32 extracts a 4 byte integer from the byte array. | [
"extractUint32",
"extracts",
"a",
"4",
"byte",
"integer",
"from",
"the",
"byte",
"array",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L491-L498 |
26,553 | minio/minio-go | api-select.go | extractUint16 | func extractUint16(r io.Reader) (uint16, error) {
buf := make([]byte, 2)
_, err := io.ReadFull(r, buf)
if err != nil {
return 0, err
}
return binary.BigEndian.Uint16(buf), nil
} | go | func extractUint16(r io.Reader) (uint16, error) {
buf := make([]byte, 2)
_, err := io.ReadFull(r, buf)
if err != nil {
return 0, err
}
return binary.BigEndian.Uint16(buf), nil
} | [
"func",
"extractUint16",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"uint16",
",",
"error",
")",
"{",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"2",
")",
"\n",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"r",
",",
"buf",
")",
"\n"... | // extractUint16 extracts a 2 byte integer from the byte array. | [
"extractUint16",
"extracts",
"a",
"2",
"byte",
"integer",
"from",
"the",
"byte",
"array",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L501-L508 |
26,554 | minio/minio-go | api-select.go | extractUint8 | func extractUint8(r io.Reader) (uint8, error) {
buf := make([]byte, 1)
_, err := io.ReadFull(r, buf)
if err != nil {
return 0, err
}
return buf[0], nil
} | go | func extractUint8(r io.Reader) (uint8, error) {
buf := make([]byte, 1)
_, err := io.ReadFull(r, buf)
if err != nil {
return 0, err
}
return buf[0], nil
} | [
"func",
"extractUint8",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"uint8",
",",
"error",
")",
"{",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"1",
")",
"\n",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"r",
",",
"buf",
")",
"\n",
... | // extractUint8 extracts a 1 byte integer from the byte array. | [
"extractUint8",
"extracts",
"a",
"1",
"byte",
"integer",
"from",
"the",
"byte",
"array",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L511-L518 |
26,555 | minio/minio-go | api-select.go | checkCRC | func checkCRC(r io.Reader, expect uint32) error {
msgCRC, err := extractUint32(r)
if err != nil {
return err
}
if msgCRC != expect {
return fmt.Errorf("Checksum Mismatch, MessageCRC of 0x%X does not equal expected CRC of 0x%X", msgCRC, expect)
}
return nil
} | go | func checkCRC(r io.Reader, expect uint32) error {
msgCRC, err := extractUint32(r)
if err != nil {
return err
}
if msgCRC != expect {
return fmt.Errorf("Checksum Mismatch, MessageCRC of 0x%X does not equal expected CRC of 0x%X", msgCRC, expect)
}
return nil
} | [
"func",
"checkCRC",
"(",
"r",
"io",
".",
"Reader",
",",
"expect",
"uint32",
")",
"error",
"{",
"msgCRC",
",",
"err",
":=",
"extractUint32",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"msgCRC",
"!="... | // checkCRC ensures that the CRC matches with the one from the reader. | [
"checkCRC",
"ensures",
"that",
"the",
"CRC",
"matches",
"with",
"the",
"one",
"from",
"the",
"reader",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-select.go#L521-L532 |
26,556 | minio/minio-go | api-stat.go | BucketExists | func (c Client) BucketExists(bucketName string) (bool, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return false, err
}
// Execute HEAD on bucketName.
resp, err := c.executeMethod(context.Background(), "HEAD", requestMetadata{
bucketName: bucketName,
c... | go | func (c Client) BucketExists(bucketName string) (bool, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return false, err
}
// Execute HEAD on bucketName.
resp, err := c.executeMethod(context.Background(), "HEAD", requestMetadata{
bucketName: bucketName,
c... | [
"func",
"(",
"c",
"Client",
")",
"BucketExists",
"(",
"bucketName",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"// Input validation.",
"if",
"err",
":=",
"s3utils",
".",
"CheckValidBucketName",
"(",
"bucketName",
")",
";",
"err",
"!=",
"nil",
"{",... | // BucketExists verify if bucket exists and you have permission to access it. | [
"BucketExists",
"verify",
"if",
"bucket",
"exists",
"and",
"you",
"have",
"permission",
"to",
"access",
"it",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-stat.go#L31-L59 |
26,557 | minio/minio-go | api-stat.go | StatObject | func (c Client) StatObject(bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return ObjectInfo{}, err
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return ObjectInfo{}, err
}
r... | go | func (c Client) StatObject(bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return ObjectInfo{}, err
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return ObjectInfo{}, err
}
r... | [
"func",
"(",
"c",
"Client",
")",
"StatObject",
"(",
"bucketName",
",",
"objectName",
"string",
",",
"opts",
"StatObjectOptions",
")",
"(",
"ObjectInfo",
",",
"error",
")",
"{",
"// Input validation.",
"if",
"err",
":=",
"s3utils",
".",
"CheckValidBucketName",
... | // StatObject verifies if object exists and you have permission to access. | [
"StatObject",
"verifies",
"if",
"object",
"exists",
"and",
"you",
"have",
"permission",
"to",
"access",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-stat.go#L93-L102 |
26,558 | minio/minio-go | api-stat.go | statObject | func (c Client) statObject(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return ObjectInfo{}, err
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return Ob... | go | func (c Client) statObject(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return ObjectInfo{}, err
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return Ob... | [
"func",
"(",
"c",
"Client",
")",
"statObject",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucketName",
",",
"objectName",
"string",
",",
"opts",
"StatObjectOptions",
")",
"(",
"ObjectInfo",
",",
"error",
")",
"{",
"// Input validation.",
"if",
"err",
":=",... | // Lower level API for statObject supporting pre-conditions and range headers. | [
"Lower",
"level",
"API",
"for",
"statObject",
"supporting",
"pre",
"-",
"conditions",
"and",
"range",
"headers",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-stat.go#L105-L192 |
26,559 | minio/minio-go | api-get-options.go | Header | func (o GetObjectOptions) Header() http.Header {
headers := make(http.Header, len(o.headers))
for k, v := range o.headers {
headers.Set(k, v)
}
if o.ServerSideEncryption != nil && o.ServerSideEncryption.Type() == encrypt.SSEC {
o.ServerSideEncryption.Marshal(headers)
}
return headers
} | go | func (o GetObjectOptions) Header() http.Header {
headers := make(http.Header, len(o.headers))
for k, v := range o.headers {
headers.Set(k, v)
}
if o.ServerSideEncryption != nil && o.ServerSideEncryption.Type() == encrypt.SSEC {
o.ServerSideEncryption.Marshal(headers)
}
return headers
} | [
"func",
"(",
"o",
"GetObjectOptions",
")",
"Header",
"(",
")",
"http",
".",
"Header",
"{",
"headers",
":=",
"make",
"(",
"http",
".",
"Header",
",",
"len",
"(",
"o",
".",
"headers",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"o",
".",
... | // Header returns the http.Header representation of the GET options. | [
"Header",
"returns",
"the",
"http",
".",
"Header",
"representation",
"of",
"the",
"GET",
"options",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-options.go#L42-L51 |
26,560 | minio/minio-go | api-get-options.go | Set | func (o *GetObjectOptions) Set(key, value string) {
if o.headers == nil {
o.headers = make(map[string]string)
}
o.headers[http.CanonicalHeaderKey(key)] = value
} | go | func (o *GetObjectOptions) Set(key, value string) {
if o.headers == nil {
o.headers = make(map[string]string)
}
o.headers[http.CanonicalHeaderKey(key)] = value
} | [
"func",
"(",
"o",
"*",
"GetObjectOptions",
")",
"Set",
"(",
"key",
",",
"value",
"string",
")",
"{",
"if",
"o",
".",
"headers",
"==",
"nil",
"{",
"o",
".",
"headers",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n",
... | // Set adds a key value pair to the options. The
// key-value pair will be part of the HTTP GET request
// headers. | [
"Set",
"adds",
"a",
"key",
"value",
"pair",
"to",
"the",
"options",
".",
"The",
"key",
"-",
"value",
"pair",
"will",
"be",
"part",
"of",
"the",
"HTTP",
"GET",
"request",
"headers",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-options.go#L56-L61 |
26,561 | minio/minio-go | api-get-options.go | SetMatchETag | func (o *GetObjectOptions) SetMatchETag(etag string) error {
if etag == "" {
return ErrInvalidArgument("ETag cannot be empty.")
}
o.Set("If-Match", "\""+etag+"\"")
return nil
} | go | func (o *GetObjectOptions) SetMatchETag(etag string) error {
if etag == "" {
return ErrInvalidArgument("ETag cannot be empty.")
}
o.Set("If-Match", "\""+etag+"\"")
return nil
} | [
"func",
"(",
"o",
"*",
"GetObjectOptions",
")",
"SetMatchETag",
"(",
"etag",
"string",
")",
"error",
"{",
"if",
"etag",
"==",
"\"",
"\"",
"{",
"return",
"ErrInvalidArgument",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"o",
".",
"Set",
"(",
"\"",
"\"",
... | // SetMatchETag - set match etag. | [
"SetMatchETag",
"-",
"set",
"match",
"etag",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-options.go#L64-L70 |
26,562 | minio/minio-go | api-get-options.go | SetUnmodified | func (o *GetObjectOptions) SetUnmodified(modTime time.Time) error {
if modTime.IsZero() {
return ErrInvalidArgument("Modified since cannot be empty.")
}
o.Set("If-Unmodified-Since", modTime.Format(http.TimeFormat))
return nil
} | go | func (o *GetObjectOptions) SetUnmodified(modTime time.Time) error {
if modTime.IsZero() {
return ErrInvalidArgument("Modified since cannot be empty.")
}
o.Set("If-Unmodified-Since", modTime.Format(http.TimeFormat))
return nil
} | [
"func",
"(",
"o",
"*",
"GetObjectOptions",
")",
"SetUnmodified",
"(",
"modTime",
"time",
".",
"Time",
")",
"error",
"{",
"if",
"modTime",
".",
"IsZero",
"(",
")",
"{",
"return",
"ErrInvalidArgument",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"o",
".",
"... | // SetUnmodified - set unmodified time since. | [
"SetUnmodified",
"-",
"set",
"unmodified",
"time",
"since",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-options.go#L82-L88 |
26,563 | minio/minio-go | api-put-object-streaming.go | putObjectNoChecksum | func (c Client) putObjectNoChecksum(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64, opts PutObjectOptions) (n int64, err error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return 0, err
}
if err := s3utils.CheckValidObjectName(objectNam... | go | func (c Client) putObjectNoChecksum(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64, opts PutObjectOptions) (n int64, err error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return 0, err
}
if err := s3utils.CheckValidObjectName(objectNam... | [
"func",
"(",
"c",
"Client",
")",
"putObjectNoChecksum",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucketName",
",",
"objectName",
"string",
",",
"reader",
"io",
".",
"Reader",
",",
"size",
"int64",
",",
"opts",
"PutObjectOptions",
")",
"(",
"n",
"int64"... | // putObjectNoChecksum special function used Google Cloud Storage. This special function
// is used for Google Cloud Storage since Google's multipart API is not S3 compatible. | [
"putObjectNoChecksum",
"special",
"function",
"used",
"Google",
"Cloud",
"Storage",
".",
"This",
"special",
"function",
"is",
"used",
"for",
"Google",
"Cloud",
"Storage",
"since",
"Google",
"s",
"multipart",
"API",
"is",
"not",
"S3",
"compatible",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object-streaming.go#L331-L370 |
26,564 | minio/minio-go | api-put-object-common.go | isReadAt | func isReadAt(reader io.Reader) (ok bool) {
var v *os.File
v, ok = reader.(*os.File)
if ok {
// Stdin, Stdout and Stderr all have *os.File type
// which happen to also be io.ReaderAt compatible
// we need to add special conditions for them to
// be ignored by this function.
for _, f := range []string{
"... | go | func isReadAt(reader io.Reader) (ok bool) {
var v *os.File
v, ok = reader.(*os.File)
if ok {
// Stdin, Stdout and Stderr all have *os.File type
// which happen to also be io.ReaderAt compatible
// we need to add special conditions for them to
// be ignored by this function.
for _, f := range []string{
"... | [
"func",
"isReadAt",
"(",
"reader",
"io",
".",
"Reader",
")",
"(",
"ok",
"bool",
")",
"{",
"var",
"v",
"*",
"os",
".",
"File",
"\n",
"v",
",",
"ok",
"=",
"reader",
".",
"(",
"*",
"os",
".",
"File",
")",
"\n",
"if",
"ok",
"{",
"// Stdin, Stdout a... | // Verify if reader is a generic ReaderAt | [
"Verify",
"if",
"reader",
"is",
"a",
"generic",
"ReaderAt"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object-common.go#L36-L58 |
26,565 | minio/minio-go | api-put-object-common.go | newUploadID | func (c Client) newUploadID(ctx context.Context, bucketName, objectName string, opts PutObjectOptions) (uploadID string, err error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return "", err
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return "",... | go | func (c Client) newUploadID(ctx context.Context, bucketName, objectName string, opts PutObjectOptions) (uploadID string, err error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return "", err
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return "",... | [
"func",
"(",
"c",
"Client",
")",
"newUploadID",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucketName",
",",
"objectName",
"string",
",",
"opts",
"PutObjectOptions",
")",
"(",
"uploadID",
"string",
",",
"err",
"error",
")",
"{",
"// Input validation.",
"if... | // getUploadID - fetch upload id if already present for an object name
// or initiate a new request to fetch a new upload id. | [
"getUploadID",
"-",
"fetch",
"upload",
"id",
"if",
"already",
"present",
"for",
"an",
"object",
"name",
"or",
"initiate",
"a",
"new",
"request",
"to",
"fetch",
"a",
"new",
"upload",
"id",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object-common.go#L123-L138 |
26,566 | minio/minio-go | api-put-object.go | getNumThreads | func (opts PutObjectOptions) getNumThreads() (numThreads int) {
if opts.NumThreads > 0 {
numThreads = int(opts.NumThreads)
} else {
numThreads = totalWorkers
}
return
} | go | func (opts PutObjectOptions) getNumThreads() (numThreads int) {
if opts.NumThreads > 0 {
numThreads = int(opts.NumThreads)
} else {
numThreads = totalWorkers
}
return
} | [
"func",
"(",
"opts",
"PutObjectOptions",
")",
"getNumThreads",
"(",
")",
"(",
"numThreads",
"int",
")",
"{",
"if",
"opts",
".",
"NumThreads",
">",
"0",
"{",
"numThreads",
"=",
"int",
"(",
"opts",
".",
"NumThreads",
")",
"\n",
"}",
"else",
"{",
"numThre... | // getNumThreads - gets the number of threads to be used in the multipart
// put object operation | [
"getNumThreads",
"-",
"gets",
"the",
"number",
"of",
"threads",
"to",
"be",
"used",
"in",
"the",
"multipart",
"put",
"object",
"operation"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object.go#L52-L59 |
26,567 | minio/minio-go | api-put-object.go | Header | func (opts PutObjectOptions) Header() (header http.Header) {
header = make(http.Header)
if opts.ContentType != "" {
header["Content-Type"] = []string{opts.ContentType}
} else {
header["Content-Type"] = []string{"application/octet-stream"}
}
if opts.ContentEncoding != "" {
header["Content-Encoding"] = []stri... | go | func (opts PutObjectOptions) Header() (header http.Header) {
header = make(http.Header)
if opts.ContentType != "" {
header["Content-Type"] = []string{opts.ContentType}
} else {
header["Content-Type"] = []string{"application/octet-stream"}
}
if opts.ContentEncoding != "" {
header["Content-Encoding"] = []stri... | [
"func",
"(",
"opts",
"PutObjectOptions",
")",
"Header",
"(",
")",
"(",
"header",
"http",
".",
"Header",
")",
"{",
"header",
"=",
"make",
"(",
"http",
".",
"Header",
")",
"\n\n",
"if",
"opts",
".",
"ContentType",
"!=",
"\"",
"\"",
"{",
"header",
"[",
... | // Header - constructs the headers from metadata entered by user in
// PutObjectOptions struct | [
"Header",
"-",
"constructs",
"the",
"headers",
"from",
"metadata",
"entered",
"by",
"user",
"in",
"PutObjectOptions",
"struct"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object.go#L63-L100 |
26,568 | minio/minio-go | api-put-object.go | PutObject | func (c Client) PutObject(bucketName, objectName string, reader io.Reader, objectSize int64,
opts PutObjectOptions) (n int64, err error) {
return c.PutObjectWithContext(context.Background(), bucketName, objectName, reader, objectSize, opts)
} | go | func (c Client) PutObject(bucketName, objectName string, reader io.Reader, objectSize int64,
opts PutObjectOptions) (n int64, err error) {
return c.PutObjectWithContext(context.Background(), bucketName, objectName, reader, objectSize, opts)
} | [
"func",
"(",
"c",
"Client",
")",
"PutObject",
"(",
"bucketName",
",",
"objectName",
"string",
",",
"reader",
"io",
".",
"Reader",
",",
"objectSize",
"int64",
",",
"opts",
"PutObjectOptions",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"return"... | // PutObject creates an object in a bucket.
//
// You must have WRITE permissions on a bucket to create an object.
//
// - For size smaller than 64MiB PutObject automatically does a
// single atomic Put operation.
// - For size larger than 64MiB PutObject automatically does a
// multipart Put operation.
// - F... | [
"PutObject",
"creates",
"an",
"object",
"in",
"a",
"bucket",
".",
"You",
"must",
"have",
"WRITE",
"permissions",
"on",
"a",
"bucket",
"to",
"create",
"an",
"object",
".",
"-",
"For",
"size",
"smaller",
"than",
"64MiB",
"PutObject",
"automatically",
"does",
... | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object.go#L134-L137 |
26,569 | minio/minio-go | api-get-object-file.go | FGetObjectWithContext | func (c Client) FGetObjectWithContext(ctx context.Context, bucketName, objectName, filePath string, opts GetObjectOptions) error {
return c.fGetObjectWithContext(ctx, bucketName, objectName, filePath, opts)
} | go | func (c Client) FGetObjectWithContext(ctx context.Context, bucketName, objectName, filePath string, opts GetObjectOptions) error {
return c.fGetObjectWithContext(ctx, bucketName, objectName, filePath, opts)
} | [
"func",
"(",
"c",
"Client",
")",
"FGetObjectWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucketName",
",",
"objectName",
",",
"filePath",
"string",
",",
"opts",
"GetObjectOptions",
")",
"error",
"{",
"return",
"c",
".",
"fGetObjectWithContext",
"... | // FGetObjectWithContext - download contents of an object to a local file.
// The options can be used to specify the GET request further. | [
"FGetObjectWithContext",
"-",
"download",
"contents",
"of",
"an",
"object",
"to",
"a",
"local",
"file",
".",
"The",
"options",
"can",
"be",
"used",
"to",
"specify",
"the",
"GET",
"request",
"further",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-object-file.go#L31-L33 |
26,570 | minio/minio-go | api-get-object-file.go | FGetObject | func (c Client) FGetObject(bucketName, objectName, filePath string, opts GetObjectOptions) error {
return c.fGetObjectWithContext(context.Background(), bucketName, objectName, filePath, opts)
} | go | func (c Client) FGetObject(bucketName, objectName, filePath string, opts GetObjectOptions) error {
return c.fGetObjectWithContext(context.Background(), bucketName, objectName, filePath, opts)
} | [
"func",
"(",
"c",
"Client",
")",
"FGetObject",
"(",
"bucketName",
",",
"objectName",
",",
"filePath",
"string",
",",
"opts",
"GetObjectOptions",
")",
"error",
"{",
"return",
"c",
".",
"fGetObjectWithContext",
"(",
"context",
".",
"Background",
"(",
")",
",",... | // FGetObject - download contents of an object to a local file. | [
"FGetObject",
"-",
"download",
"contents",
"of",
"an",
"object",
"to",
"a",
"local",
"file",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-object-file.go#L36-L38 |
26,571 | minio/minio-go | api-get-object-file.go | fGetObjectWithContext | func (c Client) fGetObjectWithContext(ctx context.Context, bucketName, objectName, filePath string, opts GetObjectOptions) error {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return err
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return err
}
/... | go | func (c Client) fGetObjectWithContext(ctx context.Context, bucketName, objectName, filePath string, opts GetObjectOptions) error {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return err
}
if err := s3utils.CheckValidObjectName(objectName); err != nil {
return err
}
/... | [
"func",
"(",
"c",
"Client",
")",
"fGetObjectWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucketName",
",",
"objectName",
",",
"filePath",
"string",
",",
"opts",
"GetObjectOptions",
")",
"error",
"{",
"// Input validation.",
"if",
"err",
":=",
"s3... | // fGetObjectWithContext - fgetObject wrapper function with context | [
"fGetObjectWithContext",
"-",
"fgetObject",
"wrapper",
"function",
"with",
"context"
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-object-file.go#L41-L125 |
26,572 | minio/minio-go | bucket-cache.go | Get | func (r *bucketLocationCache) Get(bucketName string) (location string, ok bool) {
r.RLock()
defer r.RUnlock()
location, ok = r.items[bucketName]
return
} | go | func (r *bucketLocationCache) Get(bucketName string) (location string, ok bool) {
r.RLock()
defer r.RUnlock()
location, ok = r.items[bucketName]
return
} | [
"func",
"(",
"r",
"*",
"bucketLocationCache",
")",
"Get",
"(",
"bucketName",
"string",
")",
"(",
"location",
"string",
",",
"ok",
"bool",
")",
"{",
"r",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"RUnlock",
"(",
")",
"\n",
"location",
",",
"o... | // Get - Returns a value of a given key if it exists. | [
"Get",
"-",
"Returns",
"a",
"value",
"of",
"a",
"given",
"key",
"if",
"it",
"exists",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-cache.go#L52-L57 |
26,573 | minio/minio-go | bucket-cache.go | Set | func (r *bucketLocationCache) Set(bucketName string, location string) {
r.Lock()
defer r.Unlock()
r.items[bucketName] = location
} | go | func (r *bucketLocationCache) Set(bucketName string, location string) {
r.Lock()
defer r.Unlock()
r.items[bucketName] = location
} | [
"func",
"(",
"r",
"*",
"bucketLocationCache",
")",
"Set",
"(",
"bucketName",
"string",
",",
"location",
"string",
")",
"{",
"r",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"Unlock",
"(",
")",
"\n",
"r",
".",
"items",
"[",
"bucketName",
"]",
"=... | // Set - Will persist a value into cache. | [
"Set",
"-",
"Will",
"persist",
"a",
"value",
"into",
"cache",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-cache.go#L60-L64 |
26,574 | minio/minio-go | bucket-cache.go | Delete | func (r *bucketLocationCache) Delete(bucketName string) {
r.Lock()
defer r.Unlock()
delete(r.items, bucketName)
} | go | func (r *bucketLocationCache) Delete(bucketName string) {
r.Lock()
defer r.Unlock()
delete(r.items, bucketName)
} | [
"func",
"(",
"r",
"*",
"bucketLocationCache",
")",
"Delete",
"(",
"bucketName",
"string",
")",
"{",
"r",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"Unlock",
"(",
")",
"\n",
"delete",
"(",
"r",
".",
"items",
",",
"bucketName",
")",
"\n",
"}"
] | // Delete - Deletes a bucket name from cache. | [
"Delete",
"-",
"Deletes",
"a",
"bucket",
"name",
"from",
"cache",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-cache.go#L67-L71 |
26,575 | minio/minio-go | bucket-cache.go | GetBucketLocation | func (c Client) GetBucketLocation(bucketName string) (string, error) {
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return "", err
}
return c.getBucketLocation(bucketName)
} | go | func (c Client) GetBucketLocation(bucketName string) (string, error) {
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return "", err
}
return c.getBucketLocation(bucketName)
} | [
"func",
"(",
"c",
"Client",
")",
"GetBucketLocation",
"(",
"bucketName",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s3utils",
".",
"CheckValidBucketName",
"(",
"bucketName",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\""... | // GetBucketLocation - get location for the bucket name from location cache, if not
// fetch freshly by making a new request. | [
"GetBucketLocation",
"-",
"get",
"location",
"for",
"the",
"bucket",
"name",
"from",
"location",
"cache",
"if",
"not",
"fetch",
"freshly",
"by",
"making",
"a",
"new",
"request",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-cache.go#L75-L80 |
26,576 | minio/minio-go | bucket-cache.go | getBucketLocation | func (c Client) getBucketLocation(bucketName string) (string, error) {
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return "", err
}
// Region set then no need to fetch bucket location.
if c.region != "" {
return c.region, nil
}
if location, ok := c.bucketLocCache.Get(bucketName); ok {
... | go | func (c Client) getBucketLocation(bucketName string) (string, error) {
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return "", err
}
// Region set then no need to fetch bucket location.
if c.region != "" {
return c.region, nil
}
if location, ok := c.bucketLocCache.Get(bucketName); ok {
... | [
"func",
"(",
"c",
"Client",
")",
"getBucketLocation",
"(",
"bucketName",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s3utils",
".",
"CheckValidBucketName",
"(",
"bucketName",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\""... | // getBucketLocation - Get location for the bucketName from location map cache, if not
// fetch freshly by making a new request. | [
"getBucketLocation",
"-",
"Get",
"location",
"for",
"the",
"bucketName",
"from",
"location",
"map",
"cache",
"if",
"not",
"fetch",
"freshly",
"by",
"making",
"a",
"new",
"request",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-cache.go#L84-L116 |
26,577 | minio/minio-go | bucket-cache.go | processBucketLocationResponse | func processBucketLocationResponse(resp *http.Response, bucketName string) (bucketLocation string, err error) {
if resp != nil {
if resp.StatusCode != http.StatusOK {
err = httpRespToErrorResponse(resp, bucketName, "")
errResp := ToErrorResponse(err)
// For access denied error, it could be an anonymous
/... | go | func processBucketLocationResponse(resp *http.Response, bucketName string) (bucketLocation string, err error) {
if resp != nil {
if resp.StatusCode != http.StatusOK {
err = httpRespToErrorResponse(resp, bucketName, "")
errResp := ToErrorResponse(err)
// For access denied error, it could be an anonymous
/... | [
"func",
"processBucketLocationResponse",
"(",
"resp",
"*",
"http",
".",
"Response",
",",
"bucketName",
"string",
")",
"(",
"bucketLocation",
"string",
",",
"err",
"error",
")",
"{",
"if",
"resp",
"!=",
"nil",
"{",
"if",
"resp",
".",
"StatusCode",
"!=",
"ht... | // processes the getBucketLocation http response from the server. | [
"processes",
"the",
"getBucketLocation",
"http",
"response",
"from",
"the",
"server",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-cache.go#L119-L156 |
26,578 | minio/minio-go | bucket-cache.go | getBucketLocationRequest | func (c Client) getBucketLocationRequest(bucketName string) (*http.Request, error) {
// Set location query.
urlValues := make(url.Values)
urlValues.Set("location", "")
// Set get bucket location always as path style.
targetURL := c.endpointURL
// as it works in makeTargetURL method from api.go file
if h, p, er... | go | func (c Client) getBucketLocationRequest(bucketName string) (*http.Request, error) {
// Set location query.
urlValues := make(url.Values)
urlValues.Set("location", "")
// Set get bucket location always as path style.
targetURL := c.endpointURL
// as it works in makeTargetURL method from api.go file
if h, p, er... | [
"func",
"(",
"c",
"Client",
")",
"getBucketLocationRequest",
"(",
"bucketName",
"string",
")",
"(",
"*",
"http",
".",
"Request",
",",
"error",
")",
"{",
"// Set location query.",
"urlValues",
":=",
"make",
"(",
"url",
".",
"Values",
")",
"\n",
"urlValues",
... | // getBucketLocationRequest - Wrapper creates a new getBucketLocation request. | [
"getBucketLocationRequest",
"-",
"Wrapper",
"creates",
"a",
"new",
"getBucketLocation",
"request",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/bucket-cache.go#L159-L230 |
26,579 | minio/minio-go | pkg/credentials/sts_web_identity.go | NewSTSWebIdentity | func NewSTSWebIdentity(stsEndpoint string, getWebIDTokenExpiry func() (*WebIdentityToken, error)) (*Credentials, error) {
if stsEndpoint == "" {
return nil, errors.New("STS endpoint cannot be empty")
}
if getWebIDTokenExpiry == nil {
return nil, errors.New("Web ID token and expiry retrieval function should be de... | go | func NewSTSWebIdentity(stsEndpoint string, getWebIDTokenExpiry func() (*WebIdentityToken, error)) (*Credentials, error) {
if stsEndpoint == "" {
return nil, errors.New("STS endpoint cannot be empty")
}
if getWebIDTokenExpiry == nil {
return nil, errors.New("Web ID token and expiry retrieval function should be de... | [
"func",
"NewSTSWebIdentity",
"(",
"stsEndpoint",
"string",
",",
"getWebIDTokenExpiry",
"func",
"(",
")",
"(",
"*",
"WebIdentityToken",
",",
"error",
")",
")",
"(",
"*",
"Credentials",
",",
"error",
")",
"{",
"if",
"stsEndpoint",
"==",
"\"",
"\"",
"{",
"ret... | // NewSTSWebIdentity returns a pointer to a new
// Credentials object wrapping the STSWebIdentity. | [
"NewSTSWebIdentity",
"returns",
"a",
"pointer",
"to",
"a",
"new",
"Credentials",
"object",
"wrapping",
"the",
"STSWebIdentity",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/credentials/sts_web_identity.go#L82-L96 |
26,580 | minio/minio-go | api-get-object.go | GetObject | func (c Client) GetObject(bucketName, objectName string, opts GetObjectOptions) (*Object, error) {
return c.getObjectWithContext(context.Background(), bucketName, objectName, opts)
} | go | func (c Client) GetObject(bucketName, objectName string, opts GetObjectOptions) (*Object, error) {
return c.getObjectWithContext(context.Background(), bucketName, objectName, opts)
} | [
"func",
"(",
"c",
"Client",
")",
"GetObject",
"(",
"bucketName",
",",
"objectName",
"string",
",",
"opts",
"GetObjectOptions",
")",
"(",
"*",
"Object",
",",
"error",
")",
"{",
"return",
"c",
".",
"getObjectWithContext",
"(",
"context",
".",
"Background",
"... | // GetObject - returns an seekable, readable object. | [
"GetObject",
"-",
"returns",
"an",
"seekable",
"readable",
"object",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-object.go#L34-L36 |
26,581 | minio/minio-go | api-get-object.go | doGetRequest | func (o *Object) doGetRequest(request getRequest) (getResponse, error) {
o.reqCh <- request
response := <-o.resCh
// Return any error to the top level.
if response.Error != nil {
return response, response.Error
}
// This was the first request.
if !o.isStarted {
// The object has been operated on.
o.isSta... | go | func (o *Object) doGetRequest(request getRequest) (getResponse, error) {
o.reqCh <- request
response := <-o.resCh
// Return any error to the top level.
if response.Error != nil {
return response, response.Error
}
// This was the first request.
if !o.isStarted {
// The object has been operated on.
o.isSta... | [
"func",
"(",
"o",
"*",
"Object",
")",
"doGetRequest",
"(",
"request",
"getRequest",
")",
"(",
"getResponse",
",",
"error",
")",
"{",
"o",
".",
"reqCh",
"<-",
"request",
"\n",
"response",
":=",
"<-",
"o",
".",
"resCh",
"\n\n",
"// Return any error to the to... | // doGetRequest - sends and blocks on the firstReqCh and reqCh of an object.
// Returns back the size of the buffer read, if anything was read, as well
// as any error encountered. For all first requests sent on the object
// it is also responsible for sending back the objectInfo. | [
"doGetRequest",
"-",
"sends",
"and",
"blocks",
"on",
"the",
"firstReqCh",
"and",
"reqCh",
"of",
"an",
"object",
".",
"Returns",
"back",
"the",
"size",
"of",
"the",
"buffer",
"read",
"if",
"anything",
"was",
"read",
"as",
"well",
"as",
"any",
"error",
"en... | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-object.go#L266-L294 |
26,582 | minio/minio-go | api-get-object.go | Stat | func (o *Object) Stat() (ObjectInfo, error) {
if o == nil {
return ObjectInfo{}, ErrInvalidArgument("Object is nil")
}
// Locking.
o.mutex.Lock()
defer o.mutex.Unlock()
if o.prevErr != nil && o.prevErr != io.EOF || o.isClosed {
return ObjectInfo{}, o.prevErr
}
// This is the first request.
if !o.isStarte... | go | func (o *Object) Stat() (ObjectInfo, error) {
if o == nil {
return ObjectInfo{}, ErrInvalidArgument("Object is nil")
}
// Locking.
o.mutex.Lock()
defer o.mutex.Unlock()
if o.prevErr != nil && o.prevErr != io.EOF || o.isClosed {
return ObjectInfo{}, o.prevErr
}
// This is the first request.
if !o.isStarte... | [
"func",
"(",
"o",
"*",
"Object",
")",
"Stat",
"(",
")",
"(",
"ObjectInfo",
",",
"error",
")",
"{",
"if",
"o",
"==",
"nil",
"{",
"return",
"ObjectInfo",
"{",
"}",
",",
"ErrInvalidArgument",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// Locking.",
"o",
... | // Stat returns the ObjectInfo structure describing Object. | [
"Stat",
"returns",
"the",
"ObjectInfo",
"structure",
"describing",
"Object",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-object.go#L364-L390 |
26,583 | minio/minio-go | api-presigned.go | presignURL | func (c Client) presignURL(method string, bucketName string, objectName string, expires time.Duration, reqParams url.Values) (u *url.URL, err error) {
// Input validation.
if method == "" {
return nil, ErrInvalidArgument("method cannot be empty.")
}
if err = s3utils.CheckValidBucketName(bucketName); err != nil {
... | go | func (c Client) presignURL(method string, bucketName string, objectName string, expires time.Duration, reqParams url.Values) (u *url.URL, err error) {
// Input validation.
if method == "" {
return nil, ErrInvalidArgument("method cannot be empty.")
}
if err = s3utils.CheckValidBucketName(bucketName); err != nil {
... | [
"func",
"(",
"c",
"Client",
")",
"presignURL",
"(",
"method",
"string",
",",
"bucketName",
"string",
",",
"objectName",
"string",
",",
"expires",
"time",
".",
"Duration",
",",
"reqParams",
"url",
".",
"Values",
")",
"(",
"u",
"*",
"url",
".",
"URL",
",... | // presignURL - Returns a presigned URL for an input 'method'.
// Expires maximum is 7days - ie. 604800 and minimum is 1. | [
"presignURL",
"-",
"Returns",
"a",
"presigned",
"URL",
"for",
"an",
"input",
"method",
".",
"Expires",
"maximum",
"is",
"7days",
"-",
"ie",
".",
"604800",
"and",
"minimum",
"is",
"1",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-presigned.go#L32-L61 |
26,584 | minio/minio-go | api-presigned.go | PresignedGetObject | func (c Client) PresignedGetObject(bucketName string, objectName string, expires time.Duration, reqParams url.Values) (u *url.URL, err error) {
if err = s3utils.CheckValidObjectName(objectName); err != nil {
return nil, err
}
return c.presignURL("GET", bucketName, objectName, expires, reqParams)
} | go | func (c Client) PresignedGetObject(bucketName string, objectName string, expires time.Duration, reqParams url.Values) (u *url.URL, err error) {
if err = s3utils.CheckValidObjectName(objectName); err != nil {
return nil, err
}
return c.presignURL("GET", bucketName, objectName, expires, reqParams)
} | [
"func",
"(",
"c",
"Client",
")",
"PresignedGetObject",
"(",
"bucketName",
"string",
",",
"objectName",
"string",
",",
"expires",
"time",
".",
"Duration",
",",
"reqParams",
"url",
".",
"Values",
")",
"(",
"u",
"*",
"url",
".",
"URL",
",",
"err",
"error",
... | // PresignedGetObject - Returns a presigned URL to access an object
// data without credentials. URL can have a maximum expiry of
// upto 7days or a minimum of 1sec. Additionally you can override
// a set of response headers using the query parameters. | [
"PresignedGetObject",
"-",
"Returns",
"a",
"presigned",
"URL",
"to",
"access",
"an",
"object",
"data",
"without",
"credentials",
".",
"URL",
"can",
"have",
"a",
"maximum",
"expiry",
"of",
"upto",
"7days",
"or",
"a",
"minimum",
"of",
"1sec",
".",
"Additionall... | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-presigned.go#L67-L72 |
26,585 | minio/minio-go | api-presigned.go | Presign | func (c Client) Presign(method string, bucketName string, objectName string, expires time.Duration, reqParams url.Values) (u *url.URL, err error) {
return c.presignURL(method, bucketName, objectName, expires, reqParams)
} | go | func (c Client) Presign(method string, bucketName string, objectName string, expires time.Duration, reqParams url.Values) (u *url.URL, err error) {
return c.presignURL(method, bucketName, objectName, expires, reqParams)
} | [
"func",
"(",
"c",
"Client",
")",
"Presign",
"(",
"method",
"string",
",",
"bucketName",
"string",
",",
"objectName",
"string",
",",
"expires",
"time",
".",
"Duration",
",",
"reqParams",
"url",
".",
"Values",
")",
"(",
"u",
"*",
"url",
".",
"URL",
",",
... | // Presign - returns a presigned URL for any http method of your choice
// along with custom request params. URL can have a maximum expiry of
// upto 7days or a minimum of 1sec. | [
"Presign",
"-",
"returns",
"a",
"presigned",
"URL",
"for",
"any",
"http",
"method",
"of",
"your",
"choice",
"along",
"with",
"custom",
"request",
"params",
".",
"URL",
"can",
"have",
"a",
"maximum",
"expiry",
"of",
"upto",
"7days",
"or",
"a",
"minimum",
... | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-presigned.go#L98-L100 |
26,586 | minio/minio-go | pkg/encrypt/server-side.go | NewSSEKMS | func NewSSEKMS(keyID string, context interface{}) (ServerSide, error) {
if context == nil {
return kms{key: keyID, hasContext: false}, nil
}
serializedContext, err := json.Marshal(context)
if err != nil {
return nil, err
}
return kms{key: keyID, context: serializedContext, hasContext: true}, nil
} | go | func NewSSEKMS(keyID string, context interface{}) (ServerSide, error) {
if context == nil {
return kms{key: keyID, hasContext: false}, nil
}
serializedContext, err := json.Marshal(context)
if err != nil {
return nil, err
}
return kms{key: keyID, context: serializedContext, hasContext: true}, nil
} | [
"func",
"NewSSEKMS",
"(",
"keyID",
"string",
",",
"context",
"interface",
"{",
"}",
")",
"(",
"ServerSide",
",",
"error",
")",
"{",
"if",
"context",
"==",
"nil",
"{",
"return",
"kms",
"{",
"key",
":",
"keyID",
",",
"hasContext",
":",
"false",
"}",
",... | // NewSSEKMS returns a new server-side-encryption using SSE-KMS and the provided Key Id and context. | [
"NewSSEKMS",
"returns",
"a",
"new",
"server",
"-",
"side",
"-",
"encryption",
"using",
"SSE",
"-",
"KMS",
"and",
"the",
"provided",
"Key",
"Id",
"and",
"context",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/encrypt/server-side.go#L100-L109 |
26,587 | minio/minio-go | pkg/encrypt/server-side.go | NewSSEC | func NewSSEC(key []byte) (ServerSide, error) {
if len(key) != 32 {
return nil, errors.New("encrypt: SSE-C key must be 256 bit long")
}
sse := ssec{}
copy(sse[:], key)
return sse, nil
} | go | func NewSSEC(key []byte) (ServerSide, error) {
if len(key) != 32 {
return nil, errors.New("encrypt: SSE-C key must be 256 bit long")
}
sse := ssec{}
copy(sse[:], key)
return sse, nil
} | [
"func",
"NewSSEC",
"(",
"key",
"[",
"]",
"byte",
")",
"(",
"ServerSide",
",",
"error",
")",
"{",
"if",
"len",
"(",
"key",
")",
"!=",
"32",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"sse",
":=",
"s... | // NewSSEC returns a new server-side-encryption using SSE-C and the provided key.
// The key must be 32 bytes long. | [
"NewSSEC",
"returns",
"a",
"new",
"server",
"-",
"side",
"-",
"encryption",
"using",
"SSE",
"-",
"C",
"and",
"the",
"provided",
"key",
".",
"The",
"key",
"must",
"be",
"32",
"bytes",
"long",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/encrypt/server-side.go#L113-L120 |
26,588 | minio/minio-go | pkg/policy/bucket-policy-condition.go | Add | func (ckm ConditionKeyMap) Add(key string, value set.StringSet) {
if v, ok := ckm[key]; ok {
ckm[key] = v.Union(value)
} else {
ckm[key] = set.CopyStringSet(value)
}
} | go | func (ckm ConditionKeyMap) Add(key string, value set.StringSet) {
if v, ok := ckm[key]; ok {
ckm[key] = v.Union(value)
} else {
ckm[key] = set.CopyStringSet(value)
}
} | [
"func",
"(",
"ckm",
"ConditionKeyMap",
")",
"Add",
"(",
"key",
"string",
",",
"value",
"set",
".",
"StringSet",
")",
"{",
"if",
"v",
",",
"ok",
":=",
"ckm",
"[",
"key",
"]",
";",
"ok",
"{",
"ckm",
"[",
"key",
"]",
"=",
"v",
".",
"Union",
"(",
... | // Add - adds key and value. The value is appended If key already exists. | [
"Add",
"-",
"adds",
"key",
"and",
"value",
".",
"The",
"value",
"is",
"appended",
"If",
"key",
"already",
"exists",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy-condition.go#L26-L32 |
26,589 | minio/minio-go | pkg/policy/bucket-policy-condition.go | Remove | func (ckm ConditionKeyMap) Remove(key string, value set.StringSet) {
if v, ok := ckm[key]; ok {
if value != nil {
ckm[key] = v.Difference(value)
}
if ckm[key].IsEmpty() {
delete(ckm, key)
}
}
} | go | func (ckm ConditionKeyMap) Remove(key string, value set.StringSet) {
if v, ok := ckm[key]; ok {
if value != nil {
ckm[key] = v.Difference(value)
}
if ckm[key].IsEmpty() {
delete(ckm, key)
}
}
} | [
"func",
"(",
"ckm",
"ConditionKeyMap",
")",
"Remove",
"(",
"key",
"string",
",",
"value",
"set",
".",
"StringSet",
")",
"{",
"if",
"v",
",",
"ok",
":=",
"ckm",
"[",
"key",
"]",
";",
"ok",
"{",
"if",
"value",
"!=",
"nil",
"{",
"ckm",
"[",
"key",
... | // Remove - removes value of given key. If key has empty after removal, the key is also removed. | [
"Remove",
"-",
"removes",
"value",
"of",
"given",
"key",
".",
"If",
"key",
"has",
"empty",
"after",
"removal",
"the",
"key",
"is",
"also",
"removed",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy-condition.go#L35-L45 |
26,590 | minio/minio-go | pkg/policy/bucket-policy-condition.go | RemoveKey | func (ckm ConditionKeyMap) RemoveKey(key string) {
if _, ok := ckm[key]; ok {
delete(ckm, key)
}
} | go | func (ckm ConditionKeyMap) RemoveKey(key string) {
if _, ok := ckm[key]; ok {
delete(ckm, key)
}
} | [
"func",
"(",
"ckm",
"ConditionKeyMap",
")",
"RemoveKey",
"(",
"key",
"string",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"ckm",
"[",
"key",
"]",
";",
"ok",
"{",
"delete",
"(",
"ckm",
",",
"key",
")",
"\n",
"}",
"\n",
"}"
] | // RemoveKey - removes key and its value. | [
"RemoveKey",
"-",
"removes",
"key",
"and",
"its",
"value",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy-condition.go#L48-L52 |
26,591 | minio/minio-go | pkg/policy/bucket-policy-condition.go | CopyConditionKeyMap | func CopyConditionKeyMap(condKeyMap ConditionKeyMap) ConditionKeyMap {
out := make(ConditionKeyMap)
for k, v := range condKeyMap {
out[k] = set.CopyStringSet(v)
}
return out
} | go | func CopyConditionKeyMap(condKeyMap ConditionKeyMap) ConditionKeyMap {
out := make(ConditionKeyMap)
for k, v := range condKeyMap {
out[k] = set.CopyStringSet(v)
}
return out
} | [
"func",
"CopyConditionKeyMap",
"(",
"condKeyMap",
"ConditionKeyMap",
")",
"ConditionKeyMap",
"{",
"out",
":=",
"make",
"(",
"ConditionKeyMap",
")",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"condKeyMap",
"{",
"out",
"[",
"k",
"]",
"=",
"set",
".",
"Copy... | // CopyConditionKeyMap - returns new copy of given ConditionKeyMap. | [
"CopyConditionKeyMap",
"-",
"returns",
"new",
"copy",
"of",
"given",
"ConditionKeyMap",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy-condition.go#L55-L63 |
26,592 | minio/minio-go | pkg/policy/bucket-policy-condition.go | Add | func (cond ConditionMap) Add(condKey string, condKeyMap ConditionKeyMap) {
if v, ok := cond[condKey]; ok {
cond[condKey] = mergeConditionKeyMap(v, condKeyMap)
} else {
cond[condKey] = CopyConditionKeyMap(condKeyMap)
}
} | go | func (cond ConditionMap) Add(condKey string, condKeyMap ConditionKeyMap) {
if v, ok := cond[condKey]; ok {
cond[condKey] = mergeConditionKeyMap(v, condKeyMap)
} else {
cond[condKey] = CopyConditionKeyMap(condKeyMap)
}
} | [
"func",
"(",
"cond",
"ConditionMap",
")",
"Add",
"(",
"condKey",
"string",
",",
"condKeyMap",
"ConditionKeyMap",
")",
"{",
"if",
"v",
",",
"ok",
":=",
"cond",
"[",
"condKey",
"]",
";",
"ok",
"{",
"cond",
"[",
"condKey",
"]",
"=",
"mergeConditionKeyMap",
... | // Add - adds condition key and condition value. The value is appended if key already exists. | [
"Add",
"-",
"adds",
"condition",
"key",
"and",
"condition",
"value",
".",
"The",
"value",
"is",
"appended",
"if",
"key",
"already",
"exists",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy-condition.go#L84-L90 |
26,593 | minio/minio-go | pkg/policy/bucket-policy-condition.go | Remove | func (cond ConditionMap) Remove(condKey string) {
if _, ok := cond[condKey]; ok {
delete(cond, condKey)
}
} | go | func (cond ConditionMap) Remove(condKey string) {
if _, ok := cond[condKey]; ok {
delete(cond, condKey)
}
} | [
"func",
"(",
"cond",
"ConditionMap",
")",
"Remove",
"(",
"condKey",
"string",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"cond",
"[",
"condKey",
"]",
";",
"ok",
"{",
"delete",
"(",
"cond",
",",
"condKey",
")",
"\n",
"}",
"\n",
"}"
] | // Remove - removes condition key and its value. | [
"Remove",
"-",
"removes",
"condition",
"key",
"and",
"its",
"value",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy-condition.go#L93-L97 |
26,594 | minio/minio-go | pkg/s3utils/utils.go | IsValidDomain | func IsValidDomain(host string) bool {
// See RFC 1035, RFC 3696.
host = strings.TrimSpace(host)
if len(host) == 0 || len(host) > 255 {
return false
}
// host cannot start or end with "-"
if host[len(host)-1:] == "-" || host[:1] == "-" {
return false
}
// host cannot start or end with "_"
if host[len(host)... | go | func IsValidDomain(host string) bool {
// See RFC 1035, RFC 3696.
host = strings.TrimSpace(host)
if len(host) == 0 || len(host) > 255 {
return false
}
// host cannot start or end with "-"
if host[len(host)-1:] == "-" || host[:1] == "-" {
return false
}
// host cannot start or end with "_"
if host[len(host)... | [
"func",
"IsValidDomain",
"(",
"host",
"string",
")",
"bool",
"{",
"// See RFC 1035, RFC 3696.",
"host",
"=",
"strings",
".",
"TrimSpace",
"(",
"host",
")",
"\n",
"if",
"len",
"(",
"host",
")",
"==",
"0",
"||",
"len",
"(",
"host",
")",
">",
"255",
"{",
... | // IsValidDomain validates if input string is a valid domain name. | [
"IsValidDomain",
"validates",
"if",
"input",
"string",
"is",
"a",
"valid",
"domain",
"name",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3utils/utils.go#L36-L61 |
26,595 | minio/minio-go | pkg/s3utils/utils.go | IsVirtualHostSupported | func IsVirtualHostSupported(endpointURL url.URL, bucketName string) bool {
if endpointURL == sentinelURL {
return false
}
// bucketName can be valid but '.' in the hostname will fail SSL
// certificate validation. So do not use host-style for such buckets.
if endpointURL.Scheme == "https" && strings.Contains(buc... | go | func IsVirtualHostSupported(endpointURL url.URL, bucketName string) bool {
if endpointURL == sentinelURL {
return false
}
// bucketName can be valid but '.' in the hostname will fail SSL
// certificate validation. So do not use host-style for such buckets.
if endpointURL.Scheme == "https" && strings.Contains(buc... | [
"func",
"IsVirtualHostSupported",
"(",
"endpointURL",
"url",
".",
"URL",
",",
"bucketName",
"string",
")",
"bool",
"{",
"if",
"endpointURL",
"==",
"sentinelURL",
"{",
"return",
"false",
"\n",
"}",
"\n",
"// bucketName can be valid but '.' in the hostname will fail SSL",... | // IsVirtualHostSupported - verifies if bucketName can be part of
// virtual host. Currently only Amazon S3 and Google Cloud Storage
// would support this. | [
"IsVirtualHostSupported",
"-",
"verifies",
"if",
"bucketName",
"can",
"be",
"part",
"of",
"virtual",
"host",
".",
"Currently",
"only",
"Amazon",
"S3",
"and",
"Google",
"Cloud",
"Storage",
"would",
"support",
"this",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3utils/utils.go#L71-L82 |
26,596 | minio/minio-go | pkg/s3utils/utils.go | GetRegionFromURL | func GetRegionFromURL(endpointURL url.URL) string {
if endpointURL == sentinelURL {
return ""
}
if endpointURL.Host == "s3-external-1.amazonaws.com" {
return ""
}
if IsAmazonGovCloudEndpoint(endpointURL) {
return "us-gov-west-1"
}
parts := amazonS3HostDualStack.FindStringSubmatch(endpointURL.Host)
if len(... | go | func GetRegionFromURL(endpointURL url.URL) string {
if endpointURL == sentinelURL {
return ""
}
if endpointURL.Host == "s3-external-1.amazonaws.com" {
return ""
}
if IsAmazonGovCloudEndpoint(endpointURL) {
return "us-gov-west-1"
}
parts := amazonS3HostDualStack.FindStringSubmatch(endpointURL.Host)
if len(... | [
"func",
"GetRegionFromURL",
"(",
"endpointURL",
"url",
".",
"URL",
")",
"string",
"{",
"if",
"endpointURL",
"==",
"sentinelURL",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"endpointURL",
".",
"Host",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
... | // GetRegionFromURL - returns a region from url host. | [
"GetRegionFromURL",
"-",
"returns",
"a",
"region",
"from",
"url",
"host",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3utils/utils.go#L99-L126 |
26,597 | minio/minio-go | pkg/s3utils/utils.go | IsAmazonEndpoint | func IsAmazonEndpoint(endpointURL url.URL) bool {
if endpointURL.Host == "s3-external-1.amazonaws.com" || endpointURL.Host == "s3.amazonaws.com" {
return true
}
return GetRegionFromURL(endpointURL) != ""
} | go | func IsAmazonEndpoint(endpointURL url.URL) bool {
if endpointURL.Host == "s3-external-1.amazonaws.com" || endpointURL.Host == "s3.amazonaws.com" {
return true
}
return GetRegionFromURL(endpointURL) != ""
} | [
"func",
"IsAmazonEndpoint",
"(",
"endpointURL",
"url",
".",
"URL",
")",
"bool",
"{",
"if",
"endpointURL",
".",
"Host",
"==",
"\"",
"\"",
"||",
"endpointURL",
".",
"Host",
"==",
"\"",
"\"",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"GetRegionFromU... | // IsAmazonEndpoint - Match if it is exactly Amazon S3 endpoint. | [
"IsAmazonEndpoint",
"-",
"Match",
"if",
"it",
"is",
"exactly",
"Amazon",
"S3",
"endpoint",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3utils/utils.go#L129-L134 |
26,598 | minio/minio-go | pkg/s3utils/utils.go | IsAmazonGovCloudEndpoint | func IsAmazonGovCloudEndpoint(endpointURL url.URL) bool {
if endpointURL == sentinelURL {
return false
}
return (endpointURL.Host == "s3-us-gov-west-1.amazonaws.com" ||
IsAmazonFIPSGovCloudEndpoint(endpointURL))
} | go | func IsAmazonGovCloudEndpoint(endpointURL url.URL) bool {
if endpointURL == sentinelURL {
return false
}
return (endpointURL.Host == "s3-us-gov-west-1.amazonaws.com" ||
IsAmazonFIPSGovCloudEndpoint(endpointURL))
} | [
"func",
"IsAmazonGovCloudEndpoint",
"(",
"endpointURL",
"url",
".",
"URL",
")",
"bool",
"{",
"if",
"endpointURL",
"==",
"sentinelURL",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"(",
"endpointURL",
".",
"Host",
"==",
"\"",
"\"",
"||",
"IsAmazonFIPSGo... | // IsAmazonGovCloudEndpoint - Match if it is exactly Amazon S3 GovCloud endpoint. | [
"IsAmazonGovCloudEndpoint",
"-",
"Match",
"if",
"it",
"is",
"exactly",
"Amazon",
"S3",
"GovCloud",
"endpoint",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3utils/utils.go#L137-L143 |
26,599 | minio/minio-go | pkg/s3utils/utils.go | IsGoogleEndpoint | func IsGoogleEndpoint(endpointURL url.URL) bool {
if endpointURL == sentinelURL {
return false
}
return endpointURL.Host == "storage.googleapis.com"
} | go | func IsGoogleEndpoint(endpointURL url.URL) bool {
if endpointURL == sentinelURL {
return false
}
return endpointURL.Host == "storage.googleapis.com"
} | [
"func",
"IsGoogleEndpoint",
"(",
"endpointURL",
"url",
".",
"URL",
")",
"bool",
"{",
"if",
"endpointURL",
"==",
"sentinelURL",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"endpointURL",
".",
"Host",
"==",
"\"",
"\"",
"\n",
"}"
] | // IsGoogleEndpoint - Match if it is exactly Google cloud storage endpoint. | [
"IsGoogleEndpoint",
"-",
"Match",
"if",
"it",
"is",
"exactly",
"Google",
"cloud",
"storage",
"endpoint",
"."
] | 68eef499b4c530409962a5d1a12fa8c848587761 | https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3utils/utils.go#L183-L188 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.