MCPcopy Create free account
hub / github.com/openclaw/gogcli / Create

Method Create

internal/docsbatch/repository.go:148–179  ·  view source on GitHub ↗
(state State)

Source from the content-addressed store, hash-verified

146}
147
148func (r *Repository) Create(state State) (*State, error) {
149 var created *State
150
151 err := r.lock.WithExclusive(func() error {
152 id, err := r.newID()
153 if err != nil {
154 return fmt.Errorf("create batch ID: %w", err)
155 }
156
157 if err := ValidateID(id); err != nil {
158 return fmt.Errorf("create batch ID: %w", err)
159 }
160
161 now := r.now().UTC()
162 state.BatchID = id
163 state.CreatedAt = now
164 state.UpdatedAt = now
165 state.Requests = []RequestEntry{}
166
167 if err := r.writeUnlocked(&state); err != nil {
168 return err
169 }
170 created = &state
171
172 return nil
173 })
174 if err != nil {
175 return nil, fmt.Errorf("create batch: %w", err)
176 }
177
178 return created, nil
179}
180
181func (r *Repository) List() ([]Summary, error) {
182 states, err := r.listStatesUnlocked()

Callers 15

RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
RunMethod · 0.80
UploadAssetMethod · 0.80

Calls 4

writeUnlockedMethod · 0.95
ValidateIDFunction · 0.85
WithExclusiveMethod · 0.80
ErrorfMethod · 0.80