_id
stringlengths
2
7
title
stringclasses
1 value
partition
stringclasses
3 values
text
stringlengths
6
2.61k
language
stringclasses
1 value
meta_information
dict
c6100
train
// Lookup looks up the full hash in the threat list and returns a partial // hash and a set of ThreatDescriptors that may match the full hash.
{ "resource": "" }
c6101
train
// setError clears the database state and sets the last error to be err. // // This assumes that the db.mu lock is already held.
{ "resource": "" }
c6102
train
// isStale checks whether the last successful update should be considered stale. // Staleness is defined as being older than two of the configured update periods // plus jitter.
{ "resource": "" }
c6103
train
// setStale sets the error state to a stale message, without clearing // the database state. // // This assumes that the db.ml lock is already held.
{ "resource": "" }
c6104
train
// clearError clears the db error state, and unblocks any callers of // WaitUntilReady. // // This assumes that the db.mu lock is already held.
{ "resource": "" }
c6105
train
// generateThreatsForUpdate regenerates the threatsForUpdate hashes from // the threatsForLookup. We do this to avoid holding onto the hash lists for // a long time, needlessly occupying lots of memory. // // This assumes that the db.mu lock is already held.
{ "resource": "" }
c6106
train
// generateThreatsForLookups regenerates the threatsForLookup data structure // from the threatsForUpdate data structure and stores the last timestamp. // Since the hashes are effectively stored as a set inside the threatsForLookup, // we clear out the hashes slice in threatsForUpdate so that it can be GCed. // // This...
{ "resource": "" }
c6107
train
// saveDatabase saves the database threat list to a file.
{ "resource": "" }
c6108
train
// loadDatabase loads the database state from a file.
{ "resource": "" }
c6109
train
// update updates the threat list according to the API response.
{ "resource": "" }
c6110
train
// unmarshal reads pbResp from req. The mime will either be JSON or ProtoBuf.
{ "resource": "" }
c6111
train
// marshal writes pbResp into resp. The mime can either be JSON or ProtoBuf.
{ "resource": "" }
c6112
train
// serveStatus writes a simple JSON with server status information to resp.
{ "resource": "" }
c6113
train
// serveRedirector implements a basic HTTP redirector that will filter out // redirect URLs that are unsafe according to the Safe Browsing API.
{ "resource": "" }
c6114
train
// generateHashes returns a set of full hashes for all patterns in the URL.
{ "resource": "" }
c6115
train
// generatePatterns returns all possible host-suffix and path-prefix patterns // for the input URL.
{ "resource": "" }
c6116
train
// isHex reports whether c is a hexadecimal character.
{ "resource": "" }
c6117
train
// isUnicode reports whether s is a Unicode string.
{ "resource": "" }
c6118
train
// escape returns the percent-encoded form of the string s.
{ "resource": "" }
c6119
train
// unescape returns the decoded form of a percent-encoded string s.
{ "resource": "" }
c6120
train
// recursiveUnescape unescapes the string s recursively until it cannot be // unescaped anymore. It reports an error if the unescaping process seemed to // have no end.
{ "resource": "" }
c6121
train
// normalizeEscape performs a recursive unescape and then escapes the string // exactly once. It reports an error if it was unable to unescape the string.
{ "resource": "" }
c6122
train
// parseHost parses a string to get host by the stripping the // username, password, and port.
{ "resource": "" }
c6123
train
// parseURL parses urlStr as a url.URL and reports an error if not possible.
{ "resource": "" }
c6124
train
// generateLookupHosts returns a list of host-suffixes for the input URL.
{ "resource": "" }
c6125
train
// generateLookupPaths returns a list path-prefixes for the input URL.
{ "resource": "" }
c6126
train
// hashFromPattern returns a full hash for the given URL pattern.
{ "resource": "" }
c6127
train
// HasPrefix reports whether other is a prefix of h.
{ "resource": "" }
c6128
train
// IsValid reports whether the hash is a valid partial or full hash.
{ "resource": "" }
c6129
train
// decodeHashes takes a ThreatEntrySet and returns a list of hashes that should // be added to the local database.
{ "resource": "" }
c6130
train
// decodeIndices takes a ThreatEntrySet for removals returned by the server and // returns a list of indices that the client should remove from its database.
{ "resource": "" }
c6131
train
// decodeRiceIntegers decodes a list of Golomb-Rice encoded integers.
{ "resource": "" }
c6132
train
// BitsRemaining reports the number of bits left to read.
{ "resource": "" }
c6133
train
// setDefaults configures Config to have default parameters. // It reports whether the current configuration is valid.
{ "resource": "" }
c6134
train
// NewSafeBrowser creates a new SafeBrowser. // // The conf struct allows the user to configure many aspects of the // SafeBrowser's operation.
{ "resource": "" }
c6135
train
// Status reports the status of SafeBrowser. It returns some statistics // regarding the operation, and an error representing the status of its // internal state. Most errors are transient and will recover themselves // after some period.
{ "resource": "" }
c6136
train
// WaitUntilReady blocks until the database is not in an error state. // Returns nil when the database is ready. Returns an error if the provided // context is canceled or if the SafeBrowser instance is Closed.
{ "resource": "" }
c6137
train
// Close cleans up all resources. // This method must not be called concurrently with other lookup methods.
{ "resource": "" }
c6138
train
// doRequests performs a POST to requestPath. It uses the marshaled form of req // as the request body payload, and automatically unmarshals the response body // payload as resp.
{ "resource": "" }
c6139
train
// ListUpdate issues a FetchThreatListUpdates API call and returns the response.
{ "resource": "" }
c6140
train
// HashLookup issues a FindFullHashes API call and returns the response.
{ "resource": "" }
c6141
train
// MarshalJSON implements the json.Marshaler interface. // The Duration field is marshaled in seconds, all other fields are marshaled // based upon the definitions in struct tags.
{ "resource": "" }
c6142
train
// UnmarshalJSON implements the json.Unmarshaler interface. // The Duration field is expected to be in seconds, all other field types // match the struct definition.
{ "resource": "" }
c6143
train
// ToJSON encodes f into a JSON string. Returns an error if marshalling fails.
{ "resource": "" }
c6144
train
// JSONFeed creates a new JSONFeed with a generic Feed struct's data.
{ "resource": "" }
c6145
train
// create a new RssItem with a generic Item struct's data
{ "resource": "" }
c6146
train
// create a new RssFeed with a generic Feed struct's data
{ "resource": "" }
c6147
train
// add a new Item to a Feed
{ "resource": "" }
c6148
train
// returns the first non-zero time formatted as a string or ""
{ "resource": "" }
c6149
train
// creates an Atom representation of this feed
{ "resource": "" }
c6150
train
// WriteAtom writes an Atom representation of this feed to the writer.
{ "resource": "" }
c6151
train
// creates an Rss representation of this feed
{ "resource": "" }
c6152
train
// WriteRss writes an RSS representation of this feed to the writer.
{ "resource": "" }
c6153
train
// ToJSON creates a JSON Feed representation of this feed
{ "resource": "" }
c6154
train
// WriteJSON writes an JSON representation of this feed to the writer.
{ "resource": "" }
c6155
train
// Sort sorts the Items in the feed with the given less function.
{ "resource": "" }
c6156
train
// create a new uuid v4
{ "resource": "" }
c6157
train
// create a new AtomFeed with a generic Feed struct's data
{ "resource": "" }
c6158
train
// add returns p+x. // // The whySafe string is ignored, so that the function still inlines // as efficiently as p+x, but all call sites should use the string to // record why the addition is safe, which is to say why the addition // does not cause x to advance to the very end of p's allocation // and therefore point i...
{ "resource": "" }
c6159
train
// discoverTypes initializes types and packages
{ "resource": "" }
c6160
train
// TypeByName return the type by its name, just like Class.forName in java
{ "resource": "" }
c6161
train
// TypeByPackageName return the type by its package and name
{ "resource": "" }
c6162
train
// DynamicLargeObjectCreateFile creates a dynamic large object // returning an object which satisfies io.Writer, io.Seeker, io.Closer // and io.ReaderFrom. The flags are as passes to the // largeObjectCreate method.
{ "resource": "" }
c6163
train
// DynamicLargeObjectCreate creates or truncates an existing dynamic // large object returning a writeable object. This sets opts.Flags to // an appropriate value before calling DynamicLargeObjectCreateFile
{ "resource": "" }
c6164
train
// DynamicLargeObjectDelete deletes a dynamic large object and all of its segments.
{ "resource": "" }
c6165
train
// DynamicLargeObjectMove moves a dynamic large object from srcContainer, srcObjectName to dstContainer, dstObjectName
{ "resource": "" }
c6166
train
// createDLOManifest creates a dynamic large object manifest
{ "resource": "" }
c6167
train
// newAuth - create a new Authenticator from the AuthUrl // // A hint for AuthVersion can be provided
{ "resource": "" }
c6168
train
// v1 Authentication - make request
{ "resource": "" }
c6169
train
// v1 Authentication - read response
{ "resource": "" }
c6170
train
// v1 Authentication - read storage url
{ "resource": "" }
c6171
train
// v2 Authentication - make request
{ "resource": "" }
c6172
train
// v2 Authentication - read response
{ "resource": "" }
c6173
train
// Finds the Endpoint Url of "type" from the v2AuthResponse using the // Region if set or defaulting to the first one if not // // Returns "" if not found
{ "resource": "" }
c6174
train
// v2 Authentication - read expires
{ "resource": "" }
c6175
train
// Returns a wrapper around the reader which obeys an idle // timeout. The cancel function is called if the timeout happens
{ "resource": "" }
c6176
train
// Returns a new reader which will kick the watchdog timer whenever data is read
{ "resource": "" }
c6177
train
// StaticLargeObjectCreateFile creates a static large object returning // an object which satisfies io.Writer, io.Seeker, io.Closer and // io.ReaderFrom. The flags are as passed to the largeObjectCreate // method.
{ "resource": "" }
c6178
train
// StaticLargeObjectCreate creates or truncates an existing static // large object returning a writeable object. This sets opts.Flags to // an appropriate value before calling StaticLargeObjectCreateFile
{ "resource": "" }
c6179
train
// StaticLargeObjectDelete deletes a static large object and all of its segments.
{ "resource": "" }
c6180
train
// StaticLargeObjectMove moves a static large object from srcContainer, srcObjectName to dstContainer, dstObjectName
{ "resource": "" }
c6181
train
// createSLOManifest creates a static large object manifest
{ "resource": "" }
c6182
train
// manage is similar to the swift storage method, but uses the CDN Management URL for CDN specific calls.
{ "resource": "" }
c6183
train
// ContainerCDNDisable disables CDN access to a container.
{ "resource": "" }
c6184
train
// Cancel the request
{ "resource": "" }
c6185
train
// Reset a timer
{ "resource": "" }
c6186
train
// largeObjectCreate creates a large object at opts.Container, opts.ObjectName. // // opts.Flags can have the following bits set // os.TRUNC - remove the contents of the large object if it exists // os.APPEND - write at the end of the large object
{ "resource": "" }
c6187
train
// LargeObjectDelete deletes the large object named by container, path
{ "resource": "" }
c6188
train
// Seek sets the offset for the next write operation
{ "resource": "" }
c6189
train
// Write satisfies the io.Writer interface
{ "resource": "" }
c6190
train
// Metadata gets the Metadata starting with the metaPrefix out of the Headers. // // The keys in the Metadata will be converted to lower case
{ "resource": "" }
c6191
train
// Turns a number of ns into a floating point string in seconds // // Trims trailing zeros and guaranteed to be perfectly accurate
{ "resource": "" }
c6192
train
// Turns a floating point string in seconds into a ns integer // // Guaranteed to be perfectly accurate
{ "resource": "" }
c6193
train
// newError make a new error from a string.
{ "resource": "" }
c6194
train
// newErrorf makes a new error from sprintf parameters.
{ "resource": "" }
c6195
train
// drainAndClose discards all data from rd and closes it. // If an error occurs during Read, it is discarded.
{ "resource": "" }
c6196
train
// parseHeaders checks a response for errors and translates into // standard errors if necessary. If an error is returned, resp.Body // has been drained and closed.
{ "resource": "" }
c6197
train
// Does an http request using the running timer passed in
{ "resource": "" }
c6198
train
// Set defaults for any unset values // // Call with authLock held
{ "resource": "" }
c6199
train
// Authenticate connects to the Swift server. // // If you don't call it before calling one of the connection methods // then it will be called for you on the first access.
{ "resource": "" }