| 42 | type TimedSetHistory map[string]GrantHistory |
| 43 | |
| 44 | func (timedSet TimedSetHistory) PruneHistory(partitionWindow time.Duration) []string { |
| 45 | prunedChannelHistory := make([]string, 0) |
| 46 | for chanName, grantHistory := range timedSet { |
| 47 | grantTime := time.Unix(grantHistory.UpdatedAt, 0) |
| 48 | if time.Since(grantTime) > partitionWindow { |
| 49 | delete(timedSet, chanName) |
| 50 | prunedChannelHistory = append(prunedChannelHistory, chanName) |
| 51 | } |
| 52 | } |
| 53 | return prunedChannelHistory |
| 54 | } |
| 55 | |
| 56 | type GrantHistory struct { |
| 57 | UpdatedAt int64 `json:"updated_at"` // Timestamp at which history was last updated, allows for pruning |