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 listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
148,500 | tjfoc/gmsm | sm2/cert_pool.go | AddCert | func (s *CertPool) AddCert(cert *Certificate) {
if cert == nil {
panic("adding nil Certificate to CertPool")
}
// Check that the certificate isn't being added twice.
if s.contains(cert) {
return
}
n := len(s.certs)
s.certs = append(s.certs, cert)
if len(cert.SubjectKeyId) > 0 {
keyId := string(cert.Sub... | go | func (s *CertPool) AddCert(cert *Certificate) {
if cert == nil {
panic("adding nil Certificate to CertPool")
}
// Check that the certificate isn't being added twice.
if s.contains(cert) {
return
}
n := len(s.certs)
s.certs = append(s.certs, cert)
if len(cert.SubjectKeyId) > 0 {
keyId := string(cert.Sub... | [
"func",
"(",
"s",
"*",
"CertPool",
")",
"AddCert",
"(",
"cert",
"*",
"Certificate",
")",
"{",
"if",
"cert",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Check that the certificate isn't being added twice.",
"if",
"s",
".",
"conta... | // AddCert adds a certificate to a pool. | [
"AddCert",
"adds",
"a",
"certificate",
"to",
"a",
"pool",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/cert_pool.go#L171-L190 |
148,501 | tjfoc/gmsm | sm2/cert_pool.go | Subjects | func (s *CertPool) Subjects() [][]byte {
res := make([][]byte, len(s.certs))
for i, c := range s.certs {
res[i] = c.RawSubject
}
return res
} | go | func (s *CertPool) Subjects() [][]byte {
res := make([][]byte, len(s.certs))
for i, c := range s.certs {
res[i] = c.RawSubject
}
return res
} | [
"func",
"(",
"s",
"*",
"CertPool",
")",
"Subjects",
"(",
")",
"[",
"]",
"[",
"]",
"byte",
"{",
"res",
":=",
"make",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"len",
"(",
"s",
".",
"certs",
")",
")",
"\n",
"for",
"i",
",",
"c",
":=",
"range",
... | // Subjects returns a list of the DER-encoded subjects of
// all of the certificates in the pool. | [
"Subjects",
"returns",
"a",
"list",
"of",
"the",
"DER",
"-",
"encoded",
"subjects",
"of",
"all",
"of",
"the",
"certificates",
"in",
"the",
"pool",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/cert_pool.go#L223-L229 |
148,502 | tjfoc/gmsm | sm2/verify.go | isValid | func (c *Certificate) isValid(certType int, currentChain []*Certificate, opts *VerifyOptions) error {
if len(currentChain) > 0 {
child := currentChain[len(currentChain)-1]
if !bytes.Equal(child.RawIssuer, c.RawSubject) {
return CertificateInvalidError{c, NameMismatch}
}
}
now := opts.CurrentTime
if now.IsZ... | go | func (c *Certificate) isValid(certType int, currentChain []*Certificate, opts *VerifyOptions) error {
if len(currentChain) > 0 {
child := currentChain[len(currentChain)-1]
if !bytes.Equal(child.RawIssuer, c.RawSubject) {
return CertificateInvalidError{c, NameMismatch}
}
}
now := opts.CurrentTime
if now.IsZ... | [
"func",
"(",
"c",
"*",
"Certificate",
")",
"isValid",
"(",
"certType",
"int",
",",
"currentChain",
"[",
"]",
"*",
"Certificate",
",",
"opts",
"*",
"VerifyOptions",
")",
"error",
"{",
"if",
"len",
"(",
"currentChain",
")",
">",
"0",
"{",
"child",
":=",
... | // isValid performs validity checks on the c. | [
"isValid",
"performs",
"validity",
"checks",
"on",
"the",
"c",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/verify.go#L204-L261 |
148,503 | tjfoc/gmsm | sm2/verify.go | toLowerCaseASCII | func toLowerCaseASCII(in string) string {
// If the string is already lower-case then there's nothing to do.
isAlreadyLowerCase := true
for _, c := range in {
if c == utf8.RuneError {
// If we get a UTF-8 error then there might be
// upper-case ASCII bytes in the invalid sequence.
isAlreadyLowerCase = fal... | go | func toLowerCaseASCII(in string) string {
// If the string is already lower-case then there's nothing to do.
isAlreadyLowerCase := true
for _, c := range in {
if c == utf8.RuneError {
// If we get a UTF-8 error then there might be
// upper-case ASCII bytes in the invalid sequence.
isAlreadyLowerCase = fal... | [
"func",
"toLowerCaseASCII",
"(",
"in",
"string",
")",
"string",
"{",
"// If the string is already lower-case then there's nothing to do.",
"isAlreadyLowerCase",
":=",
"true",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"in",
"{",
"if",
"c",
"==",
"utf8",
".",
"Rune... | // toLowerCaseASCII returns a lower-case version of in. See RFC 6125 6.4.1. We use
// an explicitly ASCII function to avoid any sharp corners resulting from
// performing Unicode operations on DNS labels. | [
"toLowerCaseASCII",
"returns",
"a",
"lower",
"-",
"case",
"version",
"of",
"in",
".",
"See",
"RFC",
"6125",
"6",
".",
"4",
".",
"1",
".",
"We",
"use",
"an",
"explicitly",
"ASCII",
"function",
"to",
"avoid",
"any",
"sharp",
"corners",
"resulting",
"from",... | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/verify.go#L444-L471 |
148,504 | tjfoc/gmsm | sm2/verify.go | VerifyHostname | func (c *Certificate) VerifyHostname(h string) error {
// IP addresses may be written in [ ].
candidateIP := h
if len(h) >= 3 && h[0] == '[' && h[len(h)-1] == ']' {
candidateIP = h[1 : len(h)-1]
}
if ip := net.ParseIP(candidateIP); ip != nil {
// We only match IP addresses against IP SANs.
// https://tools.i... | go | func (c *Certificate) VerifyHostname(h string) error {
// IP addresses may be written in [ ].
candidateIP := h
if len(h) >= 3 && h[0] == '[' && h[len(h)-1] == ']' {
candidateIP = h[1 : len(h)-1]
}
if ip := net.ParseIP(candidateIP); ip != nil {
// We only match IP addresses against IP SANs.
// https://tools.i... | [
"func",
"(",
"c",
"*",
"Certificate",
")",
"VerifyHostname",
"(",
"h",
"string",
")",
"error",
"{",
"// IP addresses may be written in [ ].",
"candidateIP",
":=",
"h",
"\n",
"if",
"len",
"(",
"h",
")",
">=",
"3",
"&&",
"h",
"[",
"0",
"]",
"==",
"'['",
... | // VerifyHostname returns nil if c is a valid certificate for the named host.
// Otherwise it returns an error describing the mismatch. | [
"VerifyHostname",
"returns",
"nil",
"if",
"c",
"is",
"a",
"valid",
"certificate",
"for",
"the",
"named",
"host",
".",
"Otherwise",
"it",
"returns",
"an",
"error",
"describing",
"the",
"mismatch",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/verify.go#L475-L506 |
148,505 | tjfoc/gmsm | sm2/x509.go | MarshalPKIXPublicKey | func MarshalPKIXPublicKey(pub interface{}) ([]byte, error) {
var publicKeyBytes []byte
var publicKeyAlgorithm pkix.AlgorithmIdentifier
var err error
if publicKeyBytes, publicKeyAlgorithm, err = marshalPublicKey(pub); err != nil {
return nil, err
}
pkix := pkixPublicKey{
Algo: publicKeyAlgorithm,
BitString... | go | func MarshalPKIXPublicKey(pub interface{}) ([]byte, error) {
var publicKeyBytes []byte
var publicKeyAlgorithm pkix.AlgorithmIdentifier
var err error
if publicKeyBytes, publicKeyAlgorithm, err = marshalPublicKey(pub); err != nil {
return nil, err
}
pkix := pkixPublicKey{
Algo: publicKeyAlgorithm,
BitString... | [
"func",
"MarshalPKIXPublicKey",
"(",
"pub",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"publicKeyBytes",
"[",
"]",
"byte",
"\n",
"var",
"publicKeyAlgorithm",
"pkix",
".",
"AlgorithmIdentifier",
"\n",
"var",
"err",
"er... | // MarshalPKIXPublicKey serialises a public key to DER-encoded PKIX format. | [
"MarshalPKIXPublicKey",
"serialises",
"a",
"public",
"key",
"to",
"DER",
"-",
"encoded",
"PKIX",
"format",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L130-L149 |
148,506 | tjfoc/gmsm | sm2/x509.go | rsaPSSParameters | func rsaPSSParameters(hashFunc Hash) asn1.RawValue {
var hashOID asn1.ObjectIdentifier
switch hashFunc {
case SHA256:
hashOID = oidSHA256
case SHA384:
hashOID = oidSHA384
case SHA512:
hashOID = oidSHA512
}
params := pssParameters{
Hash: pkix.AlgorithmIdentifier{
Algorithm: hashOID,
Parameters: as... | go | func rsaPSSParameters(hashFunc Hash) asn1.RawValue {
var hashOID asn1.ObjectIdentifier
switch hashFunc {
case SHA256:
hashOID = oidSHA256
case SHA384:
hashOID = oidSHA384
case SHA512:
hashOID = oidSHA512
}
params := pssParameters{
Hash: pkix.AlgorithmIdentifier{
Algorithm: hashOID,
Parameters: as... | [
"func",
"rsaPSSParameters",
"(",
"hashFunc",
"Hash",
")",
"asn1",
".",
"RawValue",
"{",
"var",
"hashOID",
"asn1",
".",
"ObjectIdentifier",
"\n\n",
"switch",
"hashFunc",
"{",
"case",
"SHA256",
":",
"hashOID",
"=",
"oidSHA256",
"\n",
"case",
"SHA384",
":",
"ha... | // rsaPSSParameters returns an asn1.RawValue suitable for use as the Parameters
// in an AlgorithmIdentifier that specifies RSA PSS. | [
"rsaPSSParameters",
"returns",
"an",
"asn1",
".",
"RawValue",
"suitable",
"for",
"use",
"as",
"the",
"Parameters",
"in",
"an",
"AlgorithmIdentifier",
"that",
"specifies",
"RSA",
"PSS",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L500-L545 |
148,507 | tjfoc/gmsm | sm2/x509.go | CheckSignatureFrom | func (c *Certificate) CheckSignatureFrom(parent *Certificate) error {
// RFC 5280, 4.2.1.9:
// "If the basic constraints extension is not present in a version 3
// certificate, or the extension is present but the cA boolean is not
// asserted, then the certified public key MUST NOT be used to verify
// certificate... | go | func (c *Certificate) CheckSignatureFrom(parent *Certificate) error {
// RFC 5280, 4.2.1.9:
// "If the basic constraints extension is not present in a version 3
// certificate, or the extension is present but the cA boolean is not
// asserted, then the certified public key MUST NOT be used to verify
// certificate... | [
"func",
"(",
"c",
"*",
"Certificate",
")",
"CheckSignatureFrom",
"(",
"parent",
"*",
"Certificate",
")",
"error",
"{",
"// RFC 5280, 4.2.1.9:",
"// \"If the basic constraints extension is not present in a version 3",
"// certificate, or the extension is present but the cA boolean is ... | // CheckSignatureFrom verifies that the signature on c is a valid signature
// from parent. | [
"CheckSignatureFrom",
"verifies",
"that",
"the",
"signature",
"on",
"c",
"is",
"a",
"valid",
"signature",
"from",
"parent",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L937-L961 |
148,508 | tjfoc/gmsm | sm2/x509.go | CheckSignature | func (c *Certificate) CheckSignature(algo SignatureAlgorithm, signed, signature []byte) error {
return checkSignature(algo, signed, signature, c.PublicKey)
} | go | func (c *Certificate) CheckSignature(algo SignatureAlgorithm, signed, signature []byte) error {
return checkSignature(algo, signed, signature, c.PublicKey)
} | [
"func",
"(",
"c",
"*",
"Certificate",
")",
"CheckSignature",
"(",
"algo",
"SignatureAlgorithm",
",",
"signed",
",",
"signature",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"checkSignature",
"(",
"algo",
",",
"signed",
",",
"signature",
",",
"c",
".",
... | // CheckSignature verifies that signature is a valid signature over signed from
// c's public key. | [
"CheckSignature",
"verifies",
"that",
"signature",
"is",
"a",
"valid",
"signature",
"over",
"signed",
"from",
"c",
"s",
"public",
"key",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L965-L967 |
148,509 | tjfoc/gmsm | sm2/x509.go | CheckCRLSignature | func (c *Certificate) CheckCRLSignature(crl *pkix.CertificateList) error {
algo := getSignatureAlgorithmFromAI(crl.SignatureAlgorithm)
return c.CheckSignature(algo, crl.TBSCertList.Raw, crl.SignatureValue.RightAlign())
} | go | func (c *Certificate) CheckCRLSignature(crl *pkix.CertificateList) error {
algo := getSignatureAlgorithmFromAI(crl.SignatureAlgorithm)
return c.CheckSignature(algo, crl.TBSCertList.Raw, crl.SignatureValue.RightAlign())
} | [
"func",
"(",
"c",
"*",
"Certificate",
")",
"CheckCRLSignature",
"(",
"crl",
"*",
"pkix",
".",
"CertificateList",
")",
"error",
"{",
"algo",
":=",
"getSignatureAlgorithmFromAI",
"(",
"crl",
".",
"SignatureAlgorithm",
")",
"\n",
"return",
"c",
".",
"CheckSignatu... | // CheckCRLSignature checks that the signature in crl is from c. | [
"CheckCRLSignature",
"checks",
"that",
"the",
"signature",
"in",
"crl",
"is",
"from",
"c",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L1050-L1053 |
148,510 | tjfoc/gmsm | sm2/x509.go | ParseCertificate | func ParseCertificate(asn1Data []byte) (*Certificate, error) {
var cert certificate
rest, err := asn1.Unmarshal(asn1Data, &cert)
if err != nil {
return nil, err
}
if len(rest) > 0 {
return nil, asn1.SyntaxError{Msg: "trailing data"}
}
return parseCertificate(&cert)
} | go | func ParseCertificate(asn1Data []byte) (*Certificate, error) {
var cert certificate
rest, err := asn1.Unmarshal(asn1Data, &cert)
if err != nil {
return nil, err
}
if len(rest) > 0 {
return nil, asn1.SyntaxError{Msg: "trailing data"}
}
return parseCertificate(&cert)
} | [
"func",
"ParseCertificate",
"(",
"asn1Data",
"[",
"]",
"byte",
")",
"(",
"*",
"Certificate",
",",
"error",
")",
"{",
"var",
"cert",
"certificate",
"\n",
"rest",
",",
"err",
":=",
"asn1",
".",
"Unmarshal",
"(",
"asn1Data",
",",
"&",
"cert",
")",
"\n",
... | // ParseCertificate parses a single certificate from the given ASN.1 DER data. | [
"ParseCertificate",
"parses",
"a",
"single",
"certificate",
"from",
"the",
"given",
"ASN",
".",
"1",
"DER",
"data",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L1510-L1521 |
148,511 | tjfoc/gmsm | sm2/x509.go | ParseCertificates | func ParseCertificates(asn1Data []byte) ([]*Certificate, error) {
var v []*certificate
for len(asn1Data) > 0 {
cert := new(certificate)
var err error
asn1Data, err = asn1.Unmarshal(asn1Data, cert)
if err != nil {
return nil, err
}
v = append(v, cert)
}
ret := make([]*Certificate, len(v))
for i, ci... | go | func ParseCertificates(asn1Data []byte) ([]*Certificate, error) {
var v []*certificate
for len(asn1Data) > 0 {
cert := new(certificate)
var err error
asn1Data, err = asn1.Unmarshal(asn1Data, cert)
if err != nil {
return nil, err
}
v = append(v, cert)
}
ret := make([]*Certificate, len(v))
for i, ci... | [
"func",
"ParseCertificates",
"(",
"asn1Data",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"*",
"Certificate",
",",
"error",
")",
"{",
"var",
"v",
"[",
"]",
"*",
"certificate",
"\n\n",
"for",
"len",
"(",
"asn1Data",
")",
">",
"0",
"{",
"cert",
":=",
"new"... | // ParseCertificates parses one or more certificates from the given ASN.1 DER
// data. The certificates must be concatenated with no intermediate padding. | [
"ParseCertificates",
"parses",
"one",
"or",
"more",
"certificates",
"from",
"the",
"given",
"ASN",
".",
"1",
"DER",
"data",
".",
"The",
"certificates",
"must",
"be",
"concatenated",
"with",
"no",
"intermediate",
"padding",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L1525-L1548 |
148,512 | tjfoc/gmsm | sm2/x509.go | asn1BitLength | func asn1BitLength(bitString []byte) int {
bitLen := len(bitString) * 8
for i := range bitString {
b := bitString[len(bitString)-i-1]
for bit := uint(0); bit < 8; bit++ {
if (b>>bit)&1 == 1 {
return bitLen
}
bitLen--
}
}
return 0
} | go | func asn1BitLength(bitString []byte) int {
bitLen := len(bitString) * 8
for i := range bitString {
b := bitString[len(bitString)-i-1]
for bit := uint(0); bit < 8; bit++ {
if (b>>bit)&1 == 1 {
return bitLen
}
bitLen--
}
}
return 0
} | [
"func",
"asn1BitLength",
"(",
"bitString",
"[",
"]",
"byte",
")",
"int",
"{",
"bitLen",
":=",
"len",
"(",
"bitString",
")",
"*",
"8",
"\n\n",
"for",
"i",
":=",
"range",
"bitString",
"{",
"b",
":=",
"bitString",
"[",
"len",
"(",
"bitString",
")",
"-",... | // asn1BitLength returns the bit-length of bitString by considering the
// most-significant bit in a byte to be the "first" bit. This convention
// matches ASN.1, but differs from almost everything else. | [
"asn1BitLength",
"returns",
"the",
"bit",
"-",
"length",
"of",
"bitString",
"by",
"considering",
"the",
"most",
"-",
"significant",
"bit",
"in",
"a",
"byte",
"to",
"be",
"the",
"first",
"bit",
".",
"This",
"convention",
"matches",
"ASN",
".",
"1",
"but",
... | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L1560-L1575 |
148,513 | tjfoc/gmsm | sm2/x509.go | marshalSANs | func marshalSANs(dnsNames, emailAddresses []string, ipAddresses []net.IP) (derBytes []byte, err error) {
var rawValues []asn1.RawValue
for _, name := range dnsNames {
rawValues = append(rawValues, asn1.RawValue{Tag: 2, Class: 2, Bytes: []byte(name)})
}
for _, email := range emailAddresses {
rawValues = append(r... | go | func marshalSANs(dnsNames, emailAddresses []string, ipAddresses []net.IP) (derBytes []byte, err error) {
var rawValues []asn1.RawValue
for _, name := range dnsNames {
rawValues = append(rawValues, asn1.RawValue{Tag: 2, Class: 2, Bytes: []byte(name)})
}
for _, email := range emailAddresses {
rawValues = append(r... | [
"func",
"marshalSANs",
"(",
"dnsNames",
",",
"emailAddresses",
"[",
"]",
"string",
",",
"ipAddresses",
"[",
"]",
"net",
".",
"IP",
")",
"(",
"derBytes",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"var",
"rawValues",
"[",
"]",
"asn1",
".",
"RawV... | // marshalSANs marshals a list of addresses into a the contents of an X.509
// SubjectAlternativeName extension. | [
"marshalSANs",
"marshals",
"a",
"list",
"of",
"addresses",
"into",
"a",
"the",
"contents",
"of",
"an",
"X",
".",
"509",
"SubjectAlternativeName",
"extension",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L1608-L1625 |
148,514 | tjfoc/gmsm | sm2/x509.go | signingParamsForPublicKey | func signingParamsForPublicKey(pub interface{}, requestedSigAlgo SignatureAlgorithm) (hashFunc Hash, sigAlgo pkix.AlgorithmIdentifier, err error) {
var pubType PublicKeyAlgorithm
switch pub := pub.(type) {
case *rsa.PublicKey:
pubType = RSA
hashFunc = SHA256
sigAlgo.Algorithm = oidSignatureSHA256WithRSA
sig... | go | func signingParamsForPublicKey(pub interface{}, requestedSigAlgo SignatureAlgorithm) (hashFunc Hash, sigAlgo pkix.AlgorithmIdentifier, err error) {
var pubType PublicKeyAlgorithm
switch pub := pub.(type) {
case *rsa.PublicKey:
pubType = RSA
hashFunc = SHA256
sigAlgo.Algorithm = oidSignatureSHA256WithRSA
sig... | [
"func",
"signingParamsForPublicKey",
"(",
"pub",
"interface",
"{",
"}",
",",
"requestedSigAlgo",
"SignatureAlgorithm",
")",
"(",
"hashFunc",
"Hash",
",",
"sigAlgo",
"pkix",
".",
"AlgorithmIdentifier",
",",
"err",
"error",
")",
"{",
"var",
"pubType",
"PublicKeyAlgo... | // signingParamsForPublicKey returns the parameters to use for signing with
// priv. If requestedSigAlgo is not zero then it overrides the default
// signature algorithm. | [
"signingParamsForPublicKey",
"returns",
"the",
"parameters",
"to",
"use",
"for",
"signing",
"with",
"priv",
".",
"If",
"requestedSigAlgo",
"is",
"not",
"zero",
"then",
"it",
"overrides",
"the",
"default",
"signature",
"algorithm",
"."
] | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L1814-L1887 |
148,515 | tjfoc/gmsm | sm2/x509.go | ParseCRL | func ParseCRL(crlBytes []byte) (*pkix.CertificateList, error) {
if bytes.HasPrefix(crlBytes, pemCRLPrefix) {
block, _ := pem.Decode(crlBytes)
if block != nil && block.Type == pemType {
crlBytes = block.Bytes
}
}
return ParseDERCRL(crlBytes)
} | go | func ParseCRL(crlBytes []byte) (*pkix.CertificateList, error) {
if bytes.HasPrefix(crlBytes, pemCRLPrefix) {
block, _ := pem.Decode(crlBytes)
if block != nil && block.Type == pemType {
crlBytes = block.Bytes
}
}
return ParseDERCRL(crlBytes)
} | [
"func",
"ParseCRL",
"(",
"crlBytes",
"[",
"]",
"byte",
")",
"(",
"*",
"pkix",
".",
"CertificateList",
",",
"error",
")",
"{",
"if",
"bytes",
".",
"HasPrefix",
"(",
"crlBytes",
",",
"pemCRLPrefix",
")",
"{",
"block",
",",
"_",
":=",
"pem",
".",
"Decod... | // ParseCRL parses a CRL from the given bytes. It's often the case that PEM
// encoded CRLs will appear where they should be DER encoded, so this function
// will transparently handle PEM encoding as long as there isn't any leading
// garbage. | [
"ParseCRL",
"parses",
"a",
"CRL",
"from",
"the",
"given",
"bytes",
".",
"It",
"s",
"often",
"the",
"case",
"that",
"PEM",
"encoded",
"CRLs",
"will",
"appear",
"where",
"they",
"should",
"be",
"DER",
"encoded",
"so",
"this",
"function",
"will",
"transparent... | 18fd8096dc8a3dcd43e9eccbdb4ef598900ae252 | https://github.com/tjfoc/gmsm/blob/18fd8096dc8a3dcd43e9eccbdb4ef598900ae252/sm2/x509.go#L2003-L2011 |
148,516 | 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 |
148,517 | 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 |
148,518 | 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 |
148,519 | 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 |
148,520 | 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 |
148,521 | 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 |
148,522 | 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 |
148,523 | 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 |
148,524 | 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 |
148,525 | 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 |
148,526 | 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 |
148,527 | 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 |
148,528 | 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 |
148,529 | 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 |
148,530 | 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 |
148,531 | 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 |
148,532 | 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 |
148,533 | 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 |
148,534 | 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 |
148,535 | 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 |
148,536 | 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 |
148,537 | 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 |
148,538 | 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 |
148,539 | 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 |
148,540 | 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 |
148,541 | 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 |
148,542 | 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 |
148,543 | 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 |
148,544 | 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 |
148,545 | 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 |
148,546 | 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 |
148,547 | 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 |
148,548 | 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 |
148,549 | 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 |
148,550 | 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 |
148,551 | 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 |
148,552 | 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 |
148,553 | 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 |
148,554 | 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 |
148,555 | 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 |
148,556 | 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 |
148,557 | 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 |
148,558 | 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 |
148,559 | 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 |
148,560 | 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 |
148,561 | 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 |
148,562 | 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 |
148,563 | 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 |
148,564 | 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 |
148,565 | 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 |
148,566 | 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 |
148,567 | 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 |
148,568 | 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 |
148,569 | 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 |
148,570 | 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 |
148,571 | 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 |
148,572 | 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 |
148,573 | 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 |
148,574 | 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 |
148,575 | 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 |
148,576 | 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 |
148,577 | 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 |
148,578 | 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 |
148,579 | 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 |
148,580 | 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 |
148,581 | 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 |
148,582 | 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 |
148,583 | 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 |
148,584 | 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 |
148,585 | 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 |
148,586 | 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 |
148,587 | 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 |
148,588 | 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 |
148,589 | 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 |
148,590 | 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 |
148,591 | 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 |
148,592 | 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 |
148,593 | 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 |
148,594 | 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 |
148,595 | 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 |
148,596 | 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 |
148,597 | 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 |
148,598 | 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 |
148,599 | 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 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.