Skip to content

Commit

Permalink
Fix some typos in lib/ (gravitational#15556)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitor Enes authored Aug 23, 2022
1 parent 3c74cee commit f7634d1
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 20 deletions.
8 changes: 4 additions & 4 deletions lib/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ type Batch interface {
//
// Here is an example of renewing object TTL:
//
// lease, err := backend.Create()
// lease.Expires = time.Now().Add(time.Second)
// Item TTL is extended
// err = backend.KeepAlive(lease)
// item.Expires = time.Now().Add(10 * time.Second)
// lease, err := backend.Create(ctx, item)
// expires := time.Now().Add(20 * time.Second)
// err = backend.KeepAlive(ctx, lease, expires)
//
type Lease struct {
// Key is an object representing lease
Expand Down
2 changes: 1 addition & 1 deletion lib/backend/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func GetName() string {
}

const (
// defaultBTreeDegreee is a default degree of a B-Tree
// defaultBTreeDegree is a default degree of a B-Tree
defaultBTreeDegree = 8
)

Expand Down
10 changes: 5 additions & 5 deletions lib/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,12 +847,12 @@ func (c *Cache) notify(ctx context.Context, event Event) {
//
// 2. Replays of stale events. Etcd provides a strong
// mechanism to track the versions of the storage - revisions
// of every operation that are uniquely numbered and monothonically
// of every operation that are uniquely numbered and monotonically
// and consistently ordered thanks to Raft. Unfortunately, DynamoDB
// does not provide such a mechanism for its event system, so
// some tradeofs have to be made:
// some tradeoffs have to be made:
// a. We assume that events are ordered in regards to the
// individual key operations which is the guarantees both Etcd and DynamodDB
// individual key operations which is the guarantees both Etcd and DynamoDB
// provide.
// b. Thanks to the init event sent by the server on a successful connect,
// and guarantees 1 and 2a, client assumes that once it connects and receives an event,
Expand Down Expand Up @@ -988,7 +988,7 @@ func (c *Cache) fetchAndWatch(ctx context.Context, retry utils.Retry, timer *tim
// most recent internally-consistent "view" of the backend, and individual consumers should
// determine if the resources they are handling are sufficiently fresh. Resource-level expiry
// is a convenience/cleanup feature and aught not be relied upon for meaningful logic anyhow.
// If we need to protect against a stale cache, we aught to invalidate the cache in its entirity, rather
// If we need to protect against a stale cache, we aught to invalidate the cache in its entirety, rather
// than pruning the resources that we think *might* have been removed from the real backend.
// TODO(fspmarshall): ^^^
//
Expand Down Expand Up @@ -1636,7 +1636,7 @@ func (c *Cache) getNodesWithTTLCache(ctx context.Context, rg readGuard, namespac
}
cachedNodes, ok := ni.([]types.Server)
if !ok {
return nil, trace.Errorf("TTL-cache returned unexpexted type %T (this is a bug!).", ni)
return nil, trace.Errorf("TTL-cache returned unexpected type %T (this is a bug!).", ni)
}
ta(cachedNodes)
return cachedNodes, nil
Expand Down
2 changes: 1 addition & 1 deletion lib/events/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const (
EventNamespace = "namespace"

// SessionPrintEvent event happens every time a write occurs to
// temirnal I/O during a session
// terminal I/O during a session
SessionPrintEvent = "print"

// SessionPrintEventBytes says how many bytes have been written into the session
Expand Down
6 changes: 3 additions & 3 deletions lib/events/auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ type AuditLogConfig struct {
// to GID
GID *int

// UID if provided will be used to set userownership of the directory
// UID if provided will be used to set user ownership of the directory
// to UID
UID *int

Expand Down Expand Up @@ -554,7 +554,7 @@ func (l *AuditLog) downloadSession(namespace string, sid session.ID) error {
return trace.ConvertSystemError(err)
}
switch {
case format.Proto == true:
case format.Proto:
start = time.Now()
l.log.Debugf("Converting %v to playback format.", tarballPath)
protoReader := NewProtoReader(tarball)
Expand All @@ -566,7 +566,7 @@ func (l *AuditLog) downloadSession(namespace string, sid session.ID) error {
stats := protoReader.GetStats().ToFields()
stats["duration"] = time.Since(start)
l.log.WithFields(stats).Debugf("Converted %v to %v.", tarballPath, l.playbackDir)
case format.Tar == true:
case format.Tar:
if err := utils.Extract(tarball, l.playbackDir); err != nil {
return trace.Wrap(err)
}
Expand Down
14 changes: 12 additions & 2 deletions lib/events/discard.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ func (*DiscardStream) Complete(ctx context.Context) error {

// EmitAuditEvent discards audit event
func (*DiscardStream) EmitAuditEvent(ctx context.Context, event apievents.AuditEvent) error {
log.Debugf("Dicarding stream event: %v", event)
log.WithFields(log.Fields{
"event_id": event.GetID(),
"event_type": event.GetType(),
"event_time": event.GetTime(),
"event_index": event.GetIndex(),
}).Debugf("Discarding stream event")
return nil
}

Expand All @@ -105,7 +110,12 @@ type DiscardEmitter struct{}

// EmitAuditEvent discards audit event
func (*DiscardEmitter) EmitAuditEvent(ctx context.Context, event apievents.AuditEvent) error {
log.Debugf("Dicarding event: %v", event)
log.WithFields(log.Fields{
"event_id": event.GetID(),
"event_type": event.GetType(),
"event_time": event.GetTime(),
"event_index": event.GetIndex(),
}).Debugf("Discarding event")
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion lib/events/dynamoevents/dynamoevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var tableSchema = []*dynamodb.AttributeDefinition{
},
}

// Config structure represents DynamoDB confniguration as appears in `storage` section
// Config structure represents DynamoDB configuration as appears in `storage` section
// of Teleport YAML
type Config struct {
// Region is where DynamoDB Table will be used to store k/v
Expand Down
6 changes: 3 additions & 3 deletions rfd/0002-streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ issues.
In pre 4.3 implementation events were buffered on disk on proxies or nodes.
This required encryption at rest, and allowed attackers to tamper
with event data. Session recording was uploaded as a single tarball,
auth server had to unpack the tarball in memory to validate it's contents,
auth server had to unpack the tarball in memory to validate its contents,
causing OOM and other performance issues. Events were not structured, and often
clients were omitting and sending wrong fields not validated by the server.

Expand Down Expand Up @@ -84,7 +84,7 @@ type AuditEvent interface {
Session events embed session metadata:
```
// SesssionMetadata is a common session event metadata
// SessionMetadata is a common session event metadata
message SessionMetadata {
// SessionID is a unique UUID of the session.
string SessionID = 1;
Expand Down Expand Up @@ -117,7 +117,7 @@ event classes without casting to specific type:
**Other event types**
Other event types, such as events dealing with connections embed other metadata,
Other event types, such as events dealing with connections embed other metadata,
for example connection metadata events:
```go
Expand Down

0 comments on commit f7634d1

Please sign in to comment.