sqs-browse: new tool

Started working on a new tool to poll and browse an SQS queue.  This is built using a TUI framework
This commit is contained in:
Leon Mika 2022-03-23 08:58:42 +11:00
parent e070505490
commit 5d1f4c78f4
11 changed files with 413 additions and 0 deletions

View file

@ -0,0 +1,31 @@
package memstore
import (
"context"
"github.com/lmika/awstools/internal/sqs-browse/models"
"sync"
)
type Store struct {
messages []models.Message
mtx *sync.Mutex
currSeqNo uint64
}
func (s *Store) Save(ctx context.Context, msg *models.Message) error {
s.mtx.Lock()
defer s.mtx.Unlock()
s.currSeqNo++
msg.ID = s.currSeqNo
s.messages = append(s.messages, *msg)
return nil
}
func NewStore() *Store {
return &Store{
messages: make([]models.Message, 0),
mtx: new(sync.Mutex),
}
}