Keep all the writers in memory.
| 518 | |
| 519 | // Keep all the writers in memory. |
| 520 | type MemcacheFileStore struct { |
| 521 | // Total number of bytes in flight right now. If this gets too |
| 522 | // large we start turning writes to be synchronous to push back |
| 523 | // against writers and protect our memory usage. |
| 524 | total_cached_bytes int64 |
| 525 | |
| 526 | mu sync.Mutex |
| 527 | |
| 528 | // For debugging. |
| 529 | id uint64 |
| 530 | ctx context.Context |
| 531 | config_obj *config_proto.Config |
| 532 | wg *sync.WaitGroup |
| 533 | |
| 534 | // The delegate will be used to actually read the data. |
| 535 | delegate api.FileStore |
| 536 | concurrency *utils.Concurrency |
| 537 | |
| 538 | // Keep the writers in memory - they will be reaped by the reaper thread |
| 539 | data_cache map[string]*MemcacheFileWriter |
| 540 | |
| 541 | // Minimum time between write and flush - this ensures quick |
| 542 | // successive writes are merged into larger ones. |
| 543 | min_age time.Duration |
| 544 | |
| 545 | // Maximum time a closed writer will be kept in memory. |
| 546 | max_age time.Duration |
| 547 | |
| 548 | closed bool |
| 549 | |
| 550 | // Pool of flusher workers |
| 551 | pool pond.Pool |
| 552 | |
| 553 | target_memory_use int64 |
| 554 | } |
| 555 | |
| 556 | func NewMemcacheFileStore( |
| 557 | ctx context.Context, |
nothing calls this directly
no outgoing calls
no test coverage detected