log

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeployLogStore

type DeployLogStore interface {
	Append(ctx context.Context, deploymentID string, entry port.LogEntry) error
	List(ctx context.Context, deploymentID string, limit int) ([]port.LogEntry, error)
	Delete(ctx context.Context, deploymentID string) error
}

DeployLogStore 는 설치 로그를 프로세스 밖에 남긴다.

type MemoryStreamer

type MemoryStreamer struct {
	// contains filtered or unexported fields
}

MemoryStreamer is an in-memory implementation of port.LogStreamer. It fans out each published log entry to all active subscribers for a deployment.

func NewMemoryStreamer

func NewMemoryStreamer() *MemoryStreamer

NewMemoryStreamer constructs a MemoryStreamer.

func (*MemoryStreamer) ClearHistory

func (s *MemoryStreamer) ClearHistory(deploymentID string)

ClearHistory 는 이 배포의 이력을 지운다.

새 실행이 이전 실행의 로그 위에 겹쳐 쌓이지 않게 한다. 구독은 건드리지 않는다 — 보고 있는 화면을 끊을 이유가 없다.

func (*MemoryStreamer) HasHistory

func (s *MemoryStreamer) HasHistory(deploymentID string) bool

HasHistory 는 이 배포의 이력이 메모리에 있는지다.

있으면 이 프로세스가 그 배포를 스트리밍했다는 뜻이라, 저장소를 겹쳐 읽으면 같은 줄이 두 번 보인다.

func (*MemoryStreamer) Stream

func (s *MemoryStreamer) Stream(ctx context.Context, deploymentID string, entry port.LogEntry)

Stream publishes entry to all subscribers of deploymentID. Non-blocking: drops the entry for any subscriber whose buffer is full.

func (*MemoryStreamer) Subscribe

func (s *MemoryStreamer) Subscribe(deploymentID string) <-chan port.LogEntry

Subscribe registers a new channel to receive log entries for deploymentID. Any previously buffered entries are replayed to the new subscriber immediately.

func (*MemoryStreamer) SubscribeWithHistory

func (s *MemoryStreamer) SubscribeWithHistory(deploymentID string, seed []port.LogEntry) <-chan port.LogEntry

SubscribeWithHistory 는 메모리에 없는 이력을 앞에 붙여 구독한다.

프로세스가 재시작되면 메모리 이력은 비어 있다. 그때 저장소에서 읽어 온 것을 이 자리로 넘기면, 재생과 구독 등록이 같은 잠금 안에서 일어나 그 사이에 들어온 실시간 항목을 놓치지 않는다.

func (*MemoryStreamer) Unsubscribe

func (s *MemoryStreamer) Unsubscribe(deploymentID string, ch <-chan port.LogEntry)

Unsubscribe removes ch from the subscriber list for deploymentID and closes it.

type PersistentStreamer

type PersistentStreamer struct {
	// contains filtered or unexported fields
}

PersistentStreamer 는 메모리 스트리머에 저장소를 덧댄다.

실시간 팬아웃은 그대로 메모리가 맡고, 같은 항목을 저장소에도 남긴다. 파드가 재시작되면 메모리 이력은 사라지지만 저장소에는 남아 있어, 재접속한 화면이 그동안의 로그를 되돌려 받는다 — 설치는 20~30분짜리라 그 사이 재시작이 겹치면 무엇이 왜 멈췄는지 알 방법이 없었다.

func NewPersistentStreamer

func NewPersistentStreamer(memory *MemoryStreamer, store DeployLogStore) *PersistentStreamer

NewPersistentStreamer 는 저장소를 덧댄 스트리머를 만든다. store 가 nil 이면 메모리 스트리머와 똑같이 동작한다.

func (*PersistentStreamer) ClearHistory

func (s *PersistentStreamer) ClearHistory(deploymentID string)

ClearHistory 는 이 배포의 로그를 메모리와 저장소 양쪽에서 지운다.

한쪽만 지우면 새 실행이 이전 실행의 로그 위에 겹쳐 쌓인다.

func (*PersistentStreamer) Stream

func (s *PersistentStreamer) Stream(ctx context.Context, deploymentID string, entry port.LogEntry)

Stream 은 항목을 저장소에 남기고 구독자에게 보낸다.

저장 실패는 스트리밍을 막지 않는다. 로그를 남기지 못하는 것이 설치를 멈출 이유는 아니다 — 실패 사실만 서버 로그에 남긴다.

func (*PersistentStreamer) Subscribe

func (s *PersistentStreamer) Subscribe(deploymentID string) <-chan port.LogEntry

Subscribe 는 그동안의 로그를 돌려주고 이후 항목을 잇는다.

이 프로세스가 그 배포를 스트리밍했으면 메모리가 진실이다. 저장소를 겹쳐 읽으면 같은 줄이 두 번 보인다. 메모리가 비어 있을 때만 — 즉 재시작 뒤에만 — 저장소에서 읽는다.

func (*PersistentStreamer) Unsubscribe

func (s *PersistentStreamer) Unsubscribe(deploymentID string, ch <-chan port.LogEntry)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL