log-search

command module
v0.0.0-...-8a6b026 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: MIT Imports: 8 Imported by: 0

README

in memory logs search

Installation

git clone https://github.com/avinashb98/log-search
cd log-search

Usage

commands
ADD
  • O(n) worst-case, n is the total number of logs
  • O(1) best-case
ADD [key] [text] 

Time Complexities

  • O(n) worst-case, n is the total number of logs
  • O(1) best-case
SEARCH [word] [limit]
input file format
# input.txt

n # number which is the maximum logs stored
.
.
command
.
.
END
Build and Run
cp input_sample.txt input.txt
# edit the sample commands file

go build .
./log-search

Test

go test -v ./...

Design

Inverted Index

The inverted index consists of 2 data structures.

KeyToEntries

It is a map of a word to a list of entryIds. Used to optimally query entries corresponding to a word.

EntryToKeys

It is a map of an entryId to a list of keys. Used to optimally unmap a deleted or updated entry.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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